Compare commits
1 Commits
main
...
general-bu
Author | SHA1 | Date | |
---|---|---|---|
|
c10ad31f11 |
|
@ -1,31 +1,25 @@
|
||||||
import { ReactNode } from 'react'
|
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
|
|
||||||
export function Button(props: {
|
export function Button(
|
||||||
className?: string
|
props: {
|
||||||
onClick?: () => void
|
size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
|
||||||
children?: ReactNode
|
color?:
|
||||||
size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
|
| 'green'
|
||||||
color?:
|
| 'red'
|
||||||
| 'green'
|
| 'blue'
|
||||||
| 'red'
|
| 'indigo'
|
||||||
| 'blue'
|
| 'yellow'
|
||||||
| 'indigo'
|
| 'gray'
|
||||||
| 'yellow'
|
| 'gradient'
|
||||||
| 'gray'
|
| 'gray-white'
|
||||||
| 'gradient'
|
} & React.ButtonHTMLAttributes<HTMLButtonElement>
|
||||||
| 'gray-white'
|
) {
|
||||||
type?: 'button' | 'reset' | 'submit'
|
|
||||||
disabled?: boolean
|
|
||||||
}) {
|
|
||||||
const {
|
const {
|
||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
onClick,
|
|
||||||
size = 'md',
|
size = 'md',
|
||||||
color = 'indigo',
|
color = 'indigo',
|
||||||
type = 'button',
|
...buttonProps // onClick, disabled, type, etc.
|
||||||
disabled = false,
|
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
const sizeClasses = {
|
const sizeClasses = {
|
||||||
|
@ -40,7 +34,6 @@ export function Button(props: {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
type={type}
|
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'font-md items-center justify-center rounded-md border border-transparent shadow-sm hover:transition-colors disabled:cursor-not-allowed disabled:opacity-50',
|
'font-md items-center justify-center rounded-md border border-transparent shadow-sm hover:transition-colors disabled:cursor-not-allowed disabled:opacity-50',
|
||||||
sizeClasses,
|
sizeClasses,
|
||||||
|
@ -56,8 +49,8 @@ export function Button(props: {
|
||||||
'border-none bg-white text-gray-500 shadow-none hover:bg-gray-200',
|
'border-none bg-white text-gray-500 shadow-none hover:bg-gray-200',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
type="button"
|
||||||
onClick={onClick}
|
{...buttonProps}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user