Implement Require Email for Notifications on Frontend

This commit is contained in:
Chi Vinh Le
2018-03-05 17:12:05 +01:00
parent 8113c4f8b8
commit 047beb1ae9
17 changed files with 312 additions and 10 deletions
@@ -3,24 +3,36 @@ import PropTypes from 'prop-types';
import { Checkbox } from 'plugin-api/beta/client/components/ui';
import styles from './Toggle.css';
import uuid from 'uuid/v4';
import cn from 'classnames';
class Toggle extends React.Component {
id = uuid();
render() {
const { checked, onChange, children } = this.props;
const { checked, onChange, children, disabled } = this.props;
return (
<div className={styles.toggle}>
<label htmlFor={this.id} className={styles.title}>
<label
htmlFor={this.id}
className={cn(styles.title, { [styles.disabled]: disabled })}
>
{children}
</label>
<Checkbox checked={checked} onChange={onChange} id={this.id} />
<div className={styles.checkBox}>
<Checkbox
checked={checked}
onChange={onChange}
id={this.id}
disabled={disabled}
/>
</div>
</div>
);
}
}
Toggle.propTypes = {
disabled: PropTypes.bool,
checked: PropTypes.bool,
onChange: PropTypes.func,
children: PropTypes.node,