initial commit

This commit is contained in:
2023-11-15 18:41:25 +01:00
commit 555fd347cc
26 changed files with 10168 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import { ComponentPropsWithoutRef, ElementType } from 'react'
import { clsx } from 'clsx'
import s from './button.module.scss'
export const buttonVariant = ['icon', 'link', 'primary', 'secondary', 'tertiary'] as const
export type ButtonVariant = (typeof buttonVariant)[number]
export type ButtonProps<T extends ElementType = 'button'> = {
as?: T
fullWidth?: boolean
variant?: ButtonVariant
} & ComponentPropsWithoutRef<T>
export const Button = <T extends ElementType = 'button'>(props: ButtonProps<T>) => {
const { as: Component = 'button', className, fullWidth, variant = 'primary', ...rest } = props
const classNames = clsx(s.button, s[variant], fullWidth && s.fullWidth, className)
return <Component className={classNames} {...rest} />
}