Files
yaak-mountain-loop/src-web/components/Button.tsx
2023-02-18 20:30:39 -08:00

25 lines
604 B
TypeScript

import classnames from 'classnames';
import { ButtonHTMLAttributes, forwardRef } from 'react';
type Props = ButtonHTMLAttributes<HTMLButtonElement> & {
color?: 'primary' | 'secondary';
};
export const Button = forwardRef<HTMLButtonElement, Props>(function Button(
{ className, color = 'primary', ...props }: Props,
ref,
) {
return (
<button
ref={ref}
className={classnames(
className,
'h-10 px-5 rounded-lg text-white',
{ 'bg-blue-500': color === 'primary' },
{ 'bg-violet-500': color === 'secondary' },
)}
{...props}
/>
);
});