2023-04-21 11:20:31 +02:00
|
|
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
|
|
|
|
|
|
|
|
import { twMerge } from "tailwind-merge"
|
|
|
|
|
|
|
|
|
|
const button = cva(
|
|
|
|
|
[
|
|
|
|
|
"justify-center",
|
|
|
|
|
"inline-flex",
|
|
|
|
|
"items-center",
|
|
|
|
|
"rounded-xl",
|
|
|
|
|
"text-center",
|
|
|
|
|
"transition-colors",
|
|
|
|
|
"delay-50",
|
|
|
|
|
],
|
|
|
|
|
{
|
|
|
|
|
variants: {
|
|
|
|
|
intent: {
|
|
|
|
|
primary: ["bg-blue-400", "text-white", "hover:enabled:bg-blue-700"],
|
2024-04-02 05:24:19 +00:00
|
|
|
secondary: ["bg-transparent", "text-white", "hover:bg-slate-100", "rounded-3xl", "hover:text-vizoleG2", "border-solid", "border-2", "border-slate-100"],
|
2024-04-02 09:49:23 +00:00
|
|
|
hero1: ["text-black", "bg-white", "font-medium", "rounded-3xl", "text-sm", "text-center", "me-2", "mb-2", "border-solid", "border-2", "border-slate-100"],
|
|
|
|
|
aboutUs: ["bg-transparent", "w-1/4", "hover:bg-blue-500", "text-blue-700", "font-semibold", "hover:text-white", "pt-5", "py-2", "px-4", "border", "border-blue-500", "hover:border-transparent", "rounded"]
|
2023-04-21 11:20:31 +02:00
|
|
|
},
|
|
|
|
|
size: {
|
|
|
|
|
sm: ["min-w-20", "h-full", "min-h-10", "text-sm", "py-1.5", "px-4"],
|
|
|
|
|
lg: ["min-w-32", "h-full", "min-h-12", "text-lg", "py-2.5", "px-6"],
|
2024-04-02 09:49:23 +00:00
|
|
|
hero1: ["min-w-15", "h-full", "min-h-5", "text-sm", "px-5", "py-2"]
|
2023-04-21 11:20:31 +02:00
|
|
|
},
|
2023-04-21 17:50:04 +02:00
|
|
|
underline: { true: ["underline"], false: [] },
|
2023-04-21 11:20:31 +02:00
|
|
|
},
|
|
|
|
|
defaultVariants: {
|
|
|
|
|
intent: "primary",
|
|
|
|
|
size: "lg",
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
2023-04-21 17:50:04 +02:00
|
|
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLAnchorElement>, VariantProps<typeof button> {
|
|
|
|
|
underline?: boolean
|
|
|
|
|
href: string
|
2023-04-21 11:20:31 +02:00
|
|
|
}
|
|
|
|
|
|
2023-04-21 17:50:04 +02:00
|
|
|
export function Button({ className, intent, size, underline, ...props }: ButtonProps) {
|
2023-04-21 11:20:31 +02:00
|
|
|
return (
|
2023-04-21 17:50:04 +02:00
|
|
|
<a className={twMerge(button({ intent, size, className, underline }))} {...props}>
|
2023-04-21 11:20:31 +02:00
|
|
|
{props.children}
|
2023-04-21 17:50:04 +02:00
|
|
|
</a>
|
2023-04-21 11:20:31 +02:00
|
|
|
)
|
|
|
|
|
}
|