2022-07-13 23:23:03 +00:00
|
|
|
import clsx from 'clsx'
|
|
|
|
import { ReactNode } from 'react'
|
|
|
|
|
|
|
|
export function PillButton(props: {
|
|
|
|
selected: boolean
|
|
|
|
onSelect: () => void
|
|
|
|
color?: string
|
2022-09-08 03:39:14 +00:00
|
|
|
xs?: boolean
|
2022-09-16 19:58:36 +00:00
|
|
|
className?: string
|
2022-07-13 23:23:03 +00:00
|
|
|
children: ReactNode
|
|
|
|
}) {
|
2022-09-16 19:58:36 +00:00
|
|
|
const { children, selected, onSelect, color, xs, className } = props
|
2022-07-13 23:23:03 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
className={clsx(
|
2022-09-08 13:40:16 +00:00
|
|
|
'cursor-pointer select-none whitespace-nowrap rounded-full px-3 py-1.5 text-sm',
|
|
|
|
xs ? 'text-xs' : '',
|
2022-07-13 23:23:03 +00:00
|
|
|
selected
|
2022-07-30 07:50:03 +00:00
|
|
|
? ['text-white', color ?? 'bg-greyscale-6']
|
2022-09-16 19:58:36 +00:00
|
|
|
: 'bg-greyscale-2 hover:bg-greyscale-3',
|
|
|
|
className
|
2022-07-13 23:23:03 +00:00
|
|
|
)}
|
|
|
|
onClick={onSelect}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
}
|