mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-15 15:26:59 +10:00
0bc53b9c2a
- update translations - convert image to base64 before sending to printer - update development docs
42 lines
2.1 KiB
TypeScript
42 lines
2.1 KiB
TypeScript
import { cva, type VariantProps } from "class-variance-authority";
|
|
import { Button as ButtonPrimitive, type ButtonProps as ButtonPrimitiveProps } from "@/components/primitives/button";
|
|
import { cn } from "@/utils/style";
|
|
|
|
const buttonVariants = cva(
|
|
"inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium text-sm outline-none transition-[box-shadow,color,background-color,border-color,outline-color,text-decoration-color,fill,stroke] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
accent: "bg-accent text-accent-foreground shadow-xs hover:bg-accent/90",
|
|
destructive:
|
|
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
outline: "border bg-background shadow-xs hover:bg-secondary/40 hover:text-secondary-foreground",
|
|
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
ghost: "hover:bg-secondary/40 hover:text-secondary-foreground",
|
|
link: "text-primary underline-offset-4 hover:underline",
|
|
},
|
|
size: {
|
|
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
icon: "size-9",
|
|
"icon-sm": "size-8 rounded-md",
|
|
"icon-lg": "size-10 rounded-md",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "default",
|
|
size: "default",
|
|
},
|
|
},
|
|
);
|
|
|
|
type ButtonProps = ButtonPrimitiveProps & VariantProps<typeof buttonVariants>;
|
|
|
|
function Button({ className, variant, size, type = "button", ...props }: ButtonProps) {
|
|
return <ButtonPrimitive type={type} className={cn(buttonVariants({ variant, size, className }))} {...props} />;
|
|
}
|
|
|
|
export { Button, buttonVariants, type ButtonProps };
|