mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 22:49:18 +00:00
refactor: create reusable buttons
This commit is contained in:
committed by
Carlos Valente
parent
44d5859844
commit
97e3e8f435
@@ -4,10 +4,15 @@ import { cx } from '../../utils/styleUtils';
|
||||
|
||||
import style from './IconButton.module.scss';
|
||||
|
||||
export default function IconButton(props: ButtonHTMLAttributes<HTMLButtonElement>) {
|
||||
const { className, children, ...buttonProps } = props;
|
||||
interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: 'subtle' | 'subtle-white' | 'destructive';
|
||||
}
|
||||
|
||||
export default function IconButton(props: IconButtonProps) {
|
||||
const { className, children, variant = 'subtle', ...buttonProps } = props;
|
||||
|
||||
return (
|
||||
<button className={cx([style.subtle, className])} {...buttonProps}>
|
||||
<button className={cx([style.baseIconButton, style[variant], className])} type='button' {...buttonProps}>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user