mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-17 13:23:35 +00:00
474f1e2177
* refactor: limited-input-device auth * refactor: resolve sheet directory from setup * refactor: extract sheet logic in backend * refactor: simplify sheet integration --------- Co-authored-by: cv <34649812+cpvalente@users.noreply.github.com> Co-authored-by: Carlos Valente <carlosvalente@pm.me>
30 lines
779 B
TypeScript
30 lines
779 B
TypeScript
import { IoBan } from '@react-icons/all-files/io5/IoBan';
|
|
|
|
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 : null, onClick ? style.selectable : null]);
|
|
|
|
if (!color) {
|
|
return (
|
|
<div className={`${classes} ${style.center}`} onClick={handleClick}>
|
|
<IoBan />
|
|
</div>
|
|
);
|
|
}
|
|
return <div className={classes} style={{ backgroundColor: `${color}` }} onClick={handleClick} />;
|
|
}
|