mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-23 02:54:58 +01:00
25 lines
604 B
TypeScript
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}
|
|
/>
|
|
);
|
|
});
|