Commit 53610cb 1 parent ea5293b commit 53610cb Copy full SHA for 53610cb
File tree 2 files changed +37
-14
lines changed
2 files changed +37
-14
lines changed Original file line number Diff line number Diff line change 1
1
import { storiesOf } from '@storybook/html' ; // eslint-disable-line import/no-extraneous-dependencies
2
2
import { // eslint-disable-line import/no-extraneous-dependencies
3
- withKnobs , radios ,
3
+ withKnobs , radios , boolean ,
4
4
} from '@storybook/addon-knobs' ;
5
5
6
6
const stories = storiesOf ( 'Inputs' , module ) ;
7
7
stories . addDecorator ( withKnobs ) ;
8
8
9
- stories . add ( 'input.radio' , ( ) => `
10
- <label>
11
- <input type="radio" class="nes-radio" name="answer" checked />
12
- <span>Yes</span>
13
- </label> <label>
14
- <input type="radio" class="nes-radio" name="answer" />
15
- <span>No</span>
16
- </label>` )
9
+ stories . add ( 'input.radio' , ( ) => {
10
+ const isDark = boolean ( 'is-dark' , false ) ? 'is-dark' : '' ;
11
+
12
+ return ( `
13
+ <label>
14
+ <input type="radio" class="nes-radio ${ isDark } " name="answer" checked />
15
+ <span>Yes</span>
16
+ </label> <label>
17
+ <input type="radio" class="nes-radio ${ isDark } " name="answer" />
18
+ <span>No</span>
19
+ </label>`
20
+ ) ;
21
+ } )
17
22
. add ( 'input.checkbox' , ( ) => {
18
- const selectedClass = radios ( 'class' , {
19
- default : '' ,
20
- 'is-dark' : 'is-dark' ,
21
- } , '' ) ;
23
+ const isDark = boolean ( 'is-dark' , false ) ? 'is-dark' : '' ;
22
24
23
25
return (
24
26
`<label>
25
- <input type="checkbox" class="nes-checkbox ${ selectedClass } " checked />
27
+ <input type="checkbox" class="nes-checkbox ${ isDark } " checked />
26
28
<span>Enable</span>
27
29
</label>`
28
30
) ;
Original file line number Diff line number Diff line change 20
20
(2 ,2 ,0 ,0 ,0 ,0 ),
21
21
);
22
22
$colors : ($base-color , map-get ($default-colors , " shadow" ));
23
+ $colors-radio-dark : ($color-white , map-get ($default-colors , " shadow" ));
23
24
24
25
margin-right : 20px ;
25
26
-webkit-appearance : none ;
50
51
& :checked:focus + span ::before {
51
52
@include pixelize (2px , $radio-checked-focus , $colors );
52
53
}
54
+ & .is-dark {
55
+ + span {
56
+ color : $color-white ;
57
+ }
58
+ // prettier-ignore
59
+ + span ::before { /* stylelint-disable-line no-descending-specificity */
60
+ color : $color-white ;
61
+ }
62
+
63
+ & :checked + span ::before {
64
+ @include pixelize (2px , $radio-checked-focus , $colors-radio-dark );
65
+
66
+ color : $color-white ;
67
+ }
68
+ & :checked:focus + span ::before {
69
+ @include pixelize (2px , $radio-checked-focus , $colors-radio-dark );
70
+
71
+ color : $color-white ;
72
+ }
73
+ }
53
74
}
You can’t perform that action at this time.
0 commit comments