import React from 'react'; import { TransitionLink } from '@/components/ui/TransitionLink'; import { cn } from './utils'; export interface ButtonProps extends React.ButtonHTMLAttributes { variant?: | 'primary' | 'secondary' | 'accent' | 'saturated' | 'outline' | 'ghost' | 'white' | 'destructive'; size?: 'sm' | 'md' | 'lg' | 'xl'; href?: string; className?: string; children?: React.ReactNode; } export const buttonBaseStyles = 'inline-flex items-center justify-center whitespace-nowrap rounded-full font-semibold transition-all duration-500 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none active:scale-95 hover:-translate-y-1 hover:scale-[1.02] relative overflow-hidden group/btn isolate'; export const buttonVariantsMap = { primary: 'bg-primary text-white shadow-md hover:shadow-primary/30 hover:shadow-2xl', secondary: 'bg-secondary text-white shadow-md hover:shadow-secondary/30 hover:shadow-2xl', accent: 'bg-accent text-primary-dark shadow-md hover:shadow-accent/30 hover:shadow-2xl', saturated: 'bg-saturated text-white shadow-md hover:shadow-primary/30 hover:shadow-2xl', outline: 'border-2 border-primary bg-transparent text-primary hover:bg-primary/5 hover:shadow-primary/20 hover:shadow-xl', ghost: 'text-primary hover:bg-primary/5 hover:shadow-lg', white: 'bg-white text-primary shadow-md hover:shadow-primary/30 hover:shadow-2xl', destructive: 'bg-destructive text-destructive-foreground shadow-md hover:shadow-destructive/30 hover:shadow-2xl', }; export const buttonSizesMap = { sm: 'h-9 px-4 text-sm md:text-base', md: 'h-11 px-6 text-base md:text-lg', lg: 'h-14 px-5 md:px-8 text-base md:text-lg', xl: 'h-16 px-6 md:px-10 text-lg md:text-xl', }; export const buttonShineColorsMap = { primary: 'via-white/30', secondary: 'via-white/30', accent: 'via-white/40', saturated: 'via-white/30', outline: 'via-primary/20', ghost: 'via-primary/10', white: 'via-primary/20', destructive: 'via-white/30', }; export function getButtonClasses(variant: keyof typeof buttonVariantsMap = 'primary', size: keyof typeof buttonSizesMap = 'md', className?: string) { return cn(buttonBaseStyles, buttonVariantsMap[variant], buttonSizesMap[size], className); } export function ButtonOverlay({ variant = 'primary' }: { variant?: keyof typeof buttonVariantsMap }) { return ( ); } export function Button({ className, variant = 'primary', size = 'md', href, ...props }: ButtonProps) { const styles = getButtonClasses(variant, size, className); const content = ( <> {props.children} ); if (href) { return ( {content} ); } return ( ); }