Skip to content

Commit

Permalink
change color buttons color
Browse files Browse the repository at this point in the history
  • Loading branch information
appsaeed committed Mar 21, 2024
1 parent a81a2fa commit 4a1f46f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/components/buttons/ButtonCircleColor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ interface Props extends React.ButtonHTMLAttributes<HTMLButtonElement> {
}

export default function ButtonCircleColor({ color, checked, ...props }: Props) {
const colour = (color && color != "") ? color : 'neutral';
const colour: string = (color && color != "") ? color : 'neutral';
const colors: { [key: string]: string } = {
"red": cn("border-red-400 hover:bg-red-500", { "bg-red-600": checked }),
"green": cn("border-green-400 hover:bg-green-500", { "bg-green-600": checked }),
"yellow": cn("border-yellow-400 hover:bg-yellow-500", { "bg-yellow-600": checked }),
"neutral": cn("border-neutral-400 hover:bg-neutral-500", { "bg-neutral-600": checked }),
}
return (
<button {...props} className={cn(`h-4 w-4 rounded-full border-2 cursor-pointer border-${colour}-400 hover:bg-${colour}-500`,
{
[`bg-${colour}-600`]: checked,
})} >
<button {...props} className={cn(`h-4 w-4 rounded-full border-2 cursor-pointer`, colors[colour])} >

</button>
)
Expand Down

0 comments on commit 4a1f46f

Please sign in to comment.