2021-04-10 12:21:02 -07:00
|
|
|
import { FunctionComponent } from 'react'
|
|
|
|
|
|
|
|
interface ButtonProps {
|
|
|
|
onClick?: (x?) => void
|
|
|
|
disabled?: boolean
|
|
|
|
className?: string
|
2022-02-20 19:55:13 -08:00
|
|
|
primary?: boolean
|
2021-04-10 12:21:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
const Button: FunctionComponent<ButtonProps> = ({
|
|
|
|
children,
|
|
|
|
onClick,
|
|
|
|
disabled = false,
|
|
|
|
className,
|
2022-07-08 03:19:38 -07:00
|
|
|
primary = true,
|
2021-04-10 12:21:02 -07:00
|
|
|
...props
|
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
onClick={onClick}
|
2021-04-12 15:15:15 -07:00
|
|
|
disabled={disabled}
|
2022-07-08 03:19:38 -07:00
|
|
|
className={`whitespace-nowrap rounded-full ${
|
|
|
|
primary ? 'bg-th-bkg-button' : 'border border-th-fgd-4'
|
|
|
|
} px-6 py-2 font-bold text-th-fgd-1 focus:outline-none disabled:cursor-not-allowed disabled:bg-th-bkg-4 disabled:text-th-fgd-4 md:hover:brightness-[1.1] md:disabled:hover:brightness-100 ${className}`}
|
2021-04-10 12:21:02 -07:00
|
|
|
{...props}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Button
|
2021-05-07 12:41:26 -07:00
|
|
|
|
|
|
|
export const LinkButton: FunctionComponent<ButtonProps> = ({
|
|
|
|
children,
|
|
|
|
onClick,
|
|
|
|
disabled = false,
|
|
|
|
className,
|
2022-02-20 19:55:13 -08:00
|
|
|
primary,
|
2021-05-07 12:41:26 -07:00
|
|
|
...props
|
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
onClick={onClick}
|
|
|
|
disabled={disabled}
|
2022-02-20 19:55:13 -08:00
|
|
|
className={`border-0 font-bold ${
|
|
|
|
primary ? 'text-th-primary' : 'text-th-fgd-2'
|
2022-06-07 17:55:46 -07:00
|
|
|
} underline focus:outline-none disabled:cursor-not-allowed disabled:underline disabled:opacity-60 md:hover:no-underline md:hover:opacity-60 ${className}`}
|
2021-05-07 12:41:26 -07:00
|
|
|
{...props}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
}
|
2021-07-29 06:19:32 -07:00
|
|
|
|
|
|
|
export const IconButton: FunctionComponent<ButtonProps> = ({
|
|
|
|
children,
|
|
|
|
onClick,
|
|
|
|
disabled = false,
|
|
|
|
className,
|
|
|
|
...props
|
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
onClick={onClick}
|
|
|
|
disabled={disabled}
|
2022-06-07 16:30:07 -07:00
|
|
|
className={`${className} flex h-7 w-7 items-center justify-center rounded-full bg-th-bkg-4 text-th-fgd-1 focus:outline-none disabled:cursor-not-allowed disabled:bg-th-bkg-4
|
2022-06-07 17:55:46 -07:00
|
|
|
disabled:text-th-fgd-4 md:hover:text-th-primary md:disabled:hover:text-th-fgd-4`}
|
2021-07-29 06:19:32 -07:00
|
|
|
{...props}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
}
|