computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
727 B
28 lines
727 B
import type { ButtonHTMLAttributes } from 'react'; |
|
import { cn } from '../../lib/classname'; |
|
|
|
type SelectionButtonProps = { |
|
text: string; |
|
isDisabled: boolean; |
|
isSelected: boolean; |
|
onClick: () => void; |
|
} & ButtonHTMLAttributes<HTMLButtonElement>; |
|
|
|
export function SelectionButton(props: SelectionButtonProps) { |
|
const { text, isDisabled, isSelected, onClick, className, ...rest } = props; |
|
|
|
return ( |
|
<button |
|
{...rest} |
|
className={cn( |
|
'rounded-md border p-1 px-2 text-sm', |
|
isSelected ? 'border-gray-500 bg-gray-300' : '', |
|
!isDisabled ? 'cursor-pointer' : 'cursor-not-allowed opacity-40', |
|
className, |
|
)} |
|
onClick={onClick} |
|
> |
|
{text} |
|
</button> |
|
); |
|
}
|
|
|