({
variant = 'primary',
className,
children,
arrow,
...props
}: ButtonProps)
| 35 | ); |
| 36 | |
| 37 | export function Button({ |
| 38 | variant = 'primary', |
| 39 | className, |
| 40 | children, |
| 41 | arrow, |
| 42 | ...props |
| 43 | }: ButtonProps) { |
| 44 | className = clsx( |
| 45 | 'inline-flex gap-0.5 justify-center overflow-hidden text-base font-medium transition', |
| 46 | variantStyles[variant], |
| 47 | className |
| 48 | ); |
| 49 | |
| 50 | let arrowIcon = ( |
| 51 | <ArrowIcon |
| 52 | className={clsx( |
| 53 | 'mt-0.5 h-5 w-5', |
| 54 | variant === 'text' && 'relative top-px', |
| 55 | arrow === 'left' && '-ml-1 rotate-180', |
| 56 | arrow === 'right' && '-mr-1' |
| 57 | )} |
| 58 | /> |
| 59 | ); |
| 60 | |
| 61 | let inner = ( |
| 62 | <> |
| 63 | {arrow === 'left' && arrowIcon} |
| 64 | {children} |
| 65 | {arrow === 'right' && arrowIcon} |
| 66 | </> |
| 67 | ); |
| 68 | |
| 69 | if (typeof props.href === 'undefined') { |
| 70 | return ( |
| 71 | <button className={className} {...props}> |
| 72 | {inner} |
| 73 | </button> |
| 74 | ); |
| 75 | } |
| 76 | |
| 77 | return ( |
| 78 | <Link className={className} {...props}> |
| 79 | {inner} |
| 80 | </Link> |
| 81 | ); |
| 82 | } |
nothing calls this directly
no outgoing calls
no test coverage detected