|
1 | 1 | import * as React from "react"; |
2 | | -import { cva, type VariantProps } from "class-variance-authority"; |
| 2 | +import { type VariantProps } from "class-variance-authority"; |
3 | 3 | import { cn } from "../lib/utils"; |
| 4 | +import { buttonVariants } from "./button-variants"; |
4 | 5 |
|
5 | 6 | /** |
6 | 7 | * Button — leaf primitive. |
7 | 8 | * |
8 | 9 | * Styled entirely from @elide/tokens (bg-primary, text-primary-foreground, …). |
9 | | - * `gradient` is the Elide brand CTA (the "Install" button). `changelog` is the |
10 | | - * violet-outlined affordance used in the docs nav. |
11 | 10 | * |
12 | 11 | * The `render` prop mirrors Base UI's composition model (replaces Radix |
13 | 12 | * `asChild`): pass an element and the button's props/classes merge onto it — |
14 | 13 | * e.g. `<Button render={<a href="/install" />}>Install</Button>`. |
15 | 14 | */ |
16 | | -const buttonVariants = cva( |
17 | | - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", |
18 | | - { |
19 | | - variants: { |
20 | | - variant: { |
21 | | - primary: "bg-primary text-primary-foreground hover:bg-primary/90", |
22 | | - gradient: "text-white [background:var(--eld-gradient-brand)] hover:opacity-95", |
23 | | - outline: "border border-border bg-transparent text-foreground hover:bg-[var(--hover)]", |
24 | | - ghost: "bg-transparent text-muted-foreground hover:bg-[var(--hover)] hover:text-foreground", |
25 | | - changelog: |
26 | | - "border text-foreground [border-color:var(--eld-accent-violet)] [background:color-mix(in_oklab,var(--eld-accent-violet)_10%,transparent)] [box-shadow:0_0_0_1px_color-mix(in_oklab,var(--eld-accent-violet)_22%,transparent),0_0_16px_-4px_color-mix(in_oklab,var(--eld-accent-violet)_55%,transparent)] hover:[background:color-mix(in_oklab,var(--eld-accent-violet)_16%,transparent)]", |
27 | | - }, |
28 | | - size: { |
29 | | - sm: "h-8 px-3 text-xs", |
30 | | - md: "h-9 px-4 text-sm", |
31 | | - icon: "h-9 w-9 p-0", |
32 | | - "icon-sm": "h-8 w-8 p-0", |
33 | | - }, |
34 | | - }, |
35 | | - defaultVariants: { variant: "primary", size: "md" }, |
36 | | - }, |
37 | | -); |
38 | | - |
39 | 15 | export interface ButtonProps |
40 | 16 | extends React.ButtonHTMLAttributes<HTMLButtonElement>, |
41 | 17 | VariantProps<typeof buttonVariants> { |
@@ -65,5 +41,3 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( |
65 | 41 | }, |
66 | 42 | ); |
67 | 43 | Button.displayName = "Button"; |
68 | | - |
69 | | -export { buttonVariants }; |
0 commit comments