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-02-22 15:30:54 -08:00
|
|
|
className={`font-bold px-6 py-2 bg-th-bkg-button rounded-full text-th-fgd-1 whitespace-nowrap hover:brightness-[1.1] focus:outline-none disabled:bg-th-bkg-4 disabled:text-th-fgd-4 disabled:cursor-not-allowed 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'
|
|
|
|
} underline hover:no-underline hover:opacity-60 focus:outline-none ${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-02-25 08:41:15 -08:00
|
|
|
className={`${className} bg-th-bkg-4 flex items-center justify-center rounded-full w-7 h-7 text-th-fgd-1 focus:outline-none hover:text-th-primary disabled:bg-th-bkg-4
|
|
|
|
disabled:text-th-fgd-4 disabled:cursor-not-allowed disabled:hover:text-th-fgd-4`}
|
2021-07-29 06:19:32 -07:00
|
|
|
{...props}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
}
|