mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 11:23:50 +00:00
d81f5fcfe1
* chore: add new icons package and remove the old one * chore: update and consolidate imports * chore: missed import
30 lines
729 B
TypeScript
30 lines
729 B
TypeScript
import { IoBan } from 'react-icons/io5';
|
|
|
|
import { cx } from '../../../utils/styleUtils';
|
|
|
|
import style from './SwatchSelect.module.scss';
|
|
|
|
interface SwatchProps {
|
|
color: string;
|
|
onClick?: (color: string) => void;
|
|
isSelected?: boolean;
|
|
}
|
|
|
|
export default function Swatch(props: SwatchProps) {
|
|
const { color, isSelected, onClick } = props;
|
|
|
|
const handleClick = () => {
|
|
onClick?.(color);
|
|
};
|
|
const classes = cx([style.swatch, isSelected && style.selected, onClick && style.selectable]);
|
|
|
|
if (!color) {
|
|
return (
|
|
<div className={classes} onClick={handleClick}>
|
|
<IoBan />
|
|
</div>
|
|
);
|
|
}
|
|
return <div className={classes} style={{ backgroundColor: `${color}` }} onClick={handleClick} />;
|
|
}
|