SPB Git

spb/spboucher.ai Public

spboucher.ai — personal website of Simon-Pierre Boucher.

TypeScript 93.4% HTML 5.5% CSS 1%
1.8 KB · 57 lines tsx
Raw Blame History
1/*2  button.tsx3  spboucher.ai Web4  Author: Simon-Pierre Boucher5  Mail: contact@spboucher.ai6*/78import * as React from "react";9import { cva, type VariantProps } from "class-variance-authority";1011import { cn } from "@/lib/utils";1213const buttonVariants = cva(14  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[0.65rem] text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] [&_svg]:size-4 [&_svg]:shrink-0",15  {16    variants: {17      variant: {18        default:19          "bg-foreground text-background shadow-sm hover:bg-foreground/88 hover:-translate-y-px",20        secondary:21          "border border-border bg-secondary text-secondary-foreground hover:border-foreground/25 hover:bg-secondary/60",22        outline:23          "border border-foreground/20 bg-transparent hover:-translate-y-px hover:border-foreground/60 hover:bg-card",24        ghost: "hover:bg-accent hover:text-accent-foreground",25        link: "text-primary underline-offset-4 hover:underline",26      },27      size: {28        default: "h-10 px-5 py-2",29        sm: "h-8 px-3.5 text-xs",30        lg: "h-11 px-8",31        icon: "h-10 w-10",32      },33    },34    defaultVariants: {35      variant: "default",36      size: "default",37    },38  }39);4041export interface ButtonProps42  extends React.ButtonHTMLAttributes<HTMLButtonElement>,43    VariantProps<typeof buttonVariants> {}4445const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(46  ({ className, variant, size, ...props }, ref) => (47    <button48      className={cn(buttonVariants({ variant, size, className }))}49      ref={ref}50      {...props}51    />52  )53);54Button.displayName = "Button";5556export { Button, buttonVariants };57