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,
|
|
|
|
...props
|
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
onClick={onClick}
|
2021-04-12 15:15:15 -07:00
|
|
|
disabled={disabled}
|
2022-03-09 12:53:11 -08:00
|
|
|
className={`whitespace-nowrap rounded-full bg-th-bkg-button px-6 py-2 font-bold text-th-fgd-1 hover:brightness-[1.1] focus:outline-none disabled:cursor-not-allowed disabled:bg-th-bkg-4 disabled:text-th-fgd-4 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-03-24 16:56:32 -07:00
|
|
|
} underline hover:no-underline hover:opacity-60 focus:outline-none disabled:cursor-not-allowed disabled:underline disabled: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-03-09 12:53:11 -08:00
|
|
|
className={`${className} flex h-7 w-7 items-center justify-center rounded-full bg-th-bkg-4 text-th-fgd-1 hover:text-th-primary focus:outline-none disabled:cursor-not-allowed
|
|
|
|
disabled:bg-th-bkg-4 disabled:text-th-fgd-4 disabled:hover:text-th-fgd-4`}
|
2021-07-29 06:19:32 -07:00
|
|
|
{...props}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
}
|