File tree Expand file tree Collapse file tree 4 files changed +72
-15
lines changed
containers/Tutorial/LevelPage/Level/Step Expand file tree Collapse file tree 4 files changed +72
-15
lines changed Original file line number Diff line number Diff line change 1+ import * as React from 'react'
2+
3+ const styles = {
4+ box : {
5+ display : 'flex' ,
6+ alignItems : 'center' ,
7+ justifyContent : 'center' ,
8+ } ,
9+ input : {
10+ border : '1px solid black' ,
11+ backgroundColor : 'yellow' ,
12+ } ,
13+ }
14+
15+ interface Props {
16+ status : 'COMPLETE' | 'INCOMPLETE' | 'ACTIVE' | 'LOADING'
17+ }
18+
19+ const Checkbox = ( props : Props ) => {
20+ const checked = props . status === 'COMPLETE'
21+ // const loading = props.state === 'LOADING'
22+ const onChange = ( ) => {
23+ /* read */
24+ }
25+ return (
26+ < div style = { styles . box } >
27+ < label >
28+ < input style = { styles . input } type = "checkbox" checked = { checked } onChange = { onChange } />
29+ </ label >
30+ </ div >
31+ )
32+ }
33+
34+ export default Checkbox
Original file line number Diff line number Diff line change 11import * as React from 'react'
22import * as T from 'typings'
3- import { Button , Checkbox } from '@alifd/next'
4-
3+ import { Button } from '@alifd/next'
4+ import Checkbox from '../../../../../components/Checkbox'
55import Markdown from '../../../../../components/Markdown'
66
77interface Props {
@@ -36,19 +36,18 @@ const Step = (props: Props) => {
3636 return (
3737 < div style = { styles . card } >
3838 < div >
39- < Checkbox
40- checked = { props . status === 'COMPLETE' }
41- indeterminate = { false /* TODO: running */ }
42- disabled = { props . status !== 'INCOMPLETE' /* TODO: and not running */ }
43- onChange = { ( ) => {
44- /* do nothing */
45- } }
46- />
39+ < Checkbox status = { props . status } />
4740 </ div >
4841 < div >
4942 < Markdown > { props . content || '' } </ Markdown >
5043 </ div >
51- < div > { showLoadSolution && < Button onClick = { onClickHandler } > Load Solution</ Button > } </ div >
44+ < div >
45+ { showLoadSolution && (
46+ < Button type = "normal" onClick = { onClickHandler } >
47+ Load Solution
48+ </ Button >
49+ ) }
50+ </ div >
5251 </ div >
5352 )
5453}
Original file line number Diff line number Diff line change @@ -2,10 +2,6 @@ import * as React from 'react'
22import ReactDOM from 'react-dom'
33import App from './App'
44
5- // base styles
6- // TODO: must be a better way to load @alifd styles
7- // currently these are loaded in src/editor/ReactWebView.ts as well
8- import '@alifd/next/dist/next.css'
95import './styles/index.css'
106
117ReactDOM . render ( < App /> , document . getElementById ( 'root' ) as HTMLElement )
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import { storiesOf } from '@storybook/react'
3+ import SideBarDecorator from './utils/SideBarDecorator'
4+
5+ import Checkbox from '../src/components/Checkbox'
6+
7+ const styles = {
8+ container : {
9+ display : 'flex' as 'flex' ,
10+ flexDirection : 'column' as 'column' ,
11+ } ,
12+ }
13+
14+ storiesOf ( 'Checkbox' , module )
15+ . addDecorator ( SideBarDecorator )
16+ . add ( 'Checkboxes' , ( ) => (
17+ < div style = { styles . container } >
18+ < span >
19+ < Checkbox status = "COMPLETE" /> Checked
20+ </ span >
21+ < span >
22+ < Checkbox status = "INCOMPLETE" /> Unchecked
23+ </ span >
24+ < span >
25+ < Checkbox status = "LOADING" /> Loading
26+ </ span >
27+ </ div >
28+ ) )
You can’t perform that action at this time.
0 commit comments