import {MDCSwitch} from '@material/switch'; import {h} from 'preact'; import MaterialComponent from '../Base/MaterialComponent'; export interface ISwitchProps extends JSX.HTMLAttributes { disabled?: boolean; } export interface ISwitchState {} export class Switch extends MaterialComponent { public MDComponent?: MDCSwitch; protected componentName = 'switch'; protected mdcProps = ['disabled', 'checked']; protected mdcNotifyProps = ['disabled', 'checked']; public componentDidMount() { super.componentDidMount(); if (this.control) { this.MDComponent = new MDCSwitch(this.control); } } public componentWillUnmount() { super.componentWillUnmount(); if (this.MDComponent) { this.MDComponent.destroy(); } } protected materialDom(allprops) { const {className, ...props} = allprops; return (
); } } export default Switch;