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