import React, { useState } from 'react'; import { Button } from '@douyinfe/semi-ui/'; import { storiesOf } from '@storybook/react'; // import { withKnobs, text, boolean } from '@storybook/addon-knobs'; import { Switch } from '../../index'; const stories = storiesOf('Switch', module); // stories.addDecorator(withKnobs);; stories.add('switch', () => (
console.log(v)} aria-label='power-switch'> console.log(v)} aria-label='power-switch'>
)); stories.add('switch size', () => (
console.log(v)}> console.log(v)} size='small' aria-label='power-switch'> console.log(v)} size='large' aria-label='power-switch'>
)); stories.add('switch checkedText & uncheckedText', () => (






)); stories.add('switch disabled', () => ( <> disabled console.log(v)} aria-label='power-switch'> )); const ControlledSwitch = () => { const [checked, onChange] = useState(true); return ( onChange(v)} /> ); }; stories.add('switch checked + onChange', () => ); const UnControlledSwitch = () => { const onChange = checked => { console.log(checked); }; return ( <> {/* */} ); }; stories.add('switch defaultChecked + onChange', () => ); class LoadingDemo extends React.Component { constructor(props) { super(props); this.state = { checked: true, loading:false } this.onChange = this.onChange.bind(this); } onChange(checked) { this.setState({ checked }); } render() { return ( <>












) } } stories.add('loading', () => );