vchikalkin 0424d8da50 packages/ui: elements style
apps/web: page render elements from meta
2023-11-09 13:47:45 +03:00

26 lines
817 B
TypeScript

import { cn } from './utils';
import type { VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
import type { ButtonHTMLAttributes } from 'react';
import { forwardRef } from 'react';
const variants = cva('rounded-sm h-10 px-5 py-2.5 text-sm font-medium text-white', {
defaultVariants: {
color: 'default',
},
variants: {
color: {
danger: 'bg-danger hover:bg-danger-700',
default: 'bg-primary hover:bg-primary-700',
},
},
});
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof variants>;
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
({ className, color, ...props }, ref) => (
<button type="button" className={cn(variants({ className, color }))} ref={ref} {...props} />
)
);