Modify checkboxes so that they can be indeterminate

To add the third state, we create our own checkboxes using font awesome
icons.
This commit is contained in:
René Pfeuffer
2020-06-24 15:20:28 +02:00
parent 149b6cbc2a
commit c5a2d04789
7 changed files with 119 additions and 21 deletions

View File

@@ -30,6 +30,7 @@ type Props = {
name: string;
color: string;
className?: string;
onClick?: () => void;
};
export default class Icon extends React.Component<Props> {
@@ -39,12 +40,12 @@ export default class Icon extends React.Component<Props> {
};
render() {
const { title, iconStyle, name, color, className } = this.props;
const { title, iconStyle, name, color, className, onClick } = this.props;
if (title) {
return (
<i title={title} className={classNames(iconStyle, "fa-fw", "fa-" + name, `has-text-${color}`, className)} />
<i onClick={onClick} title={title} className={classNames(iconStyle, "fa-fw", "fa-" + name, `has-text-${color}`, className)} />
);
}
return <i className={classNames(iconStyle, "fa-" + name, `has-text-${color}`, className)} />;
return <i onClick={onClick} className={classNames(iconStyle, "fa-" + name, `has-text-${color}`, className)} />;
}
}