File tree Expand file tree Collapse file tree 2 files changed +62
-26
lines changed Expand file tree Collapse file tree 2 files changed +62
-26
lines changed Original file line number Diff line number Diff line change 1
- import Button from './button' ;
2
- import Card from './card' ;
3
- import Checkbox from './checkbox' ;
4
- import CheckboxGroup from './checkboxGroup' ;
5
-
6
- export default {
7
- Button,
8
- Card,
9
- Checkbox,
10
- CheckboxGroup,
11
- } ;
1
+ // import Button from './button';
2
+ // import Card from './card';
3
+ // import Checkbox from './checkbox';
4
+ // import CheckboxGroup from './checkboxGroup';
12
5
6
+ // export default {
7
+ // Button,
8
+ // Card,
9
+ // Checkbox,
10
+ // CheckboxGroup,
11
+ // };
12
+
13
+ import React from 'react' ;
14
+ import ReactDOM from 'react-dom' ;
15
+ import Toggle from './toggle' ;
16
+
17
+ class ToggleDisplay extends React . Component {
18
+ constructor ( props ) {
19
+ super ( props ) ;
20
+
21
+ this . state = {
22
+ toggled : false ,
23
+ } ;
24
+ }
25
+
26
+ handleToggle = ( ) => {
27
+ this . setState ( {
28
+ toggled : ! this . state . toggled ,
29
+ } ) ;
30
+ }
31
+
32
+ render ( ) {
33
+ return (
34
+ < Toggle
35
+ toggled = { this . state . toggled }
36
+ onClick = { this . handleToggle }
37
+ />
38
+ ) ;
39
+ }
40
+ }
41
+
42
+ ReactDOM . render ( < ToggleDisplay /> , document . getElementById ( 'index' ) ) ;
Original file line number Diff line number Diff line change 1
1
:local(.toggle ) {
2
2
background-color : #ccc ;
3
3
padding : 2px ;
4
+ display : inline-block ;
5
+ width : 60px ;
6
+ height : 35px ;
7
+ position : relative ;
4
8
& :hover {
5
9
cursor : pointer ;
6
10
}
7
11
input {
8
12
/* Disable the HTML input */
9
13
opacity : 0 ;
10
14
}
15
+ & :before {
16
+ position : absolute ;
17
+ content : " " ;
18
+ height : 70% ;
19
+ width : 35% ;
20
+ left : 10% ;
21
+ top : 15% ;
22
+ background-color : white ;
23
+ }
11
24
}
12
25
13
26
:local(.toggled ) {
14
- background-color : #2196F3 !important ;
15
- height : 200px ;
16
- position : relative ;
17
- .toggle-item {
18
- /* Toggle item class */
19
- /* Builds a rectange with border width and rotates it 45 Degree */
27
+ background-color : #2196F3 ;
28
+ & :before {
20
29
position : absolute ;
21
- left : 30% ;
22
- top : 10% ;
23
- width : 5px ;
24
- height : 10px ;
25
- border : solid white ;
26
- border-width : 0 3px 3px 0 ;
27
- -webkit-transform : rotate (45deg );
28
- -ms-transform : rotate (45deg );
29
- transform : rotate (45deg );
30
+ content : " " ;
31
+ height : 70% ;
32
+ width : 35% ;
33
+ left : 55% ;
34
+ top : 15% ;
35
+ background-color : white ;
30
36
}
31
37
}
You can’t perform that action at this time.
0 commit comments