Browse Source

added BtnSwitch component

Skylsmoi 7 years ago
parent
commit
80ba9f6a38

File diff suppressed because it is too large
+ 1 - 1
dist/tracim_lib.js


+ 16 - 0
src/component/Input/BtnSwitch/BtnSwitch.jsx View File

@@ -0,0 +1,16 @@
1
+import React from 'react'
2
+
3
+require('./BtnSwitch.styl')
4
+
5
+export const BtnSwitch = props =>
6
+  <div className='btnswitch'>
7
+    <label className='switch nomarginlabel'>
8
+      <input type='checkbox' />
9
+      <span className='slider round' />
10
+    </label>
11
+    <div className='btnswitch__text'>
12
+      On
13
+    </div>
14
+  </div>
15
+
16
+export default BtnSwitch

+ 57 - 0
src/component/Input/BtnSwitch/BtnSwitch.styl View File

@@ -0,0 +1,57 @@
1
+@import '../../../css/Variable.styl'
2
+
3
+.btnswitch
4
+  display flex
5
+  align-items center
6
+  &__text
7
+    margin-left 10px
8
+
9
+.switch
10
+  position relative
11
+  display inline-block
12
+  width 60px
13
+  height 34px
14
+
15
+.switch input
16
+  display none
17
+
18
+.slider
19
+  position absolute
20
+  cursor pointer
21
+  top 0
22
+  left 0
23
+  right 0
24
+  bottom 0
25
+  background-color #ccc
26
+  -webkit-transition .4s
27
+  transition .4s
28
+
29
+.slider:before
30
+  position absolute
31
+  content ""
32
+  height 26px
33
+  width 26px
34
+  left 4px
35
+  bottom 4px
36
+  background-color white
37
+  -webkit-transition .4s
38
+  transition .4s
39
+
40
+input:checked + .slider
41
+  background-color blue
42
+
43
+input:focus + .slider
44
+  box-shadow 0 0 1px blue
45
+
46
+input:checked + .slider:before
47
+  -webkit-transform translateX(26px)
48
+  -ms-transform translateX(26px)
49
+  transform translateX(26px)
50
+
51
+/* Rounded sliders */
52
+.slider.round
53
+  border-radius 34px
54
+
55
+.slider.round:before
56
+  border-radius: 50%
57
+

src/component/Input/TextAreaPlugin.jsx → src/component/Input/TextAreaPlugin/TextAreaPlugin.jsx View File


src/component/Input/TextAreaPlugin.styl → src/component/Input/TextAreaPlugin/TextAreaPlugin.styl View File

@@ -1,4 +1,4 @@
1
-@import '../../css/Variable.styl'
1
+@import '../../../css/Variable.styl'
2 2
 
3 3
 .editiontitle
4 4
   width 60%

+ 4 - 1
src/index.dev.js View File

@@ -6,7 +6,8 @@ import PopinFixedHeader from './component/PopinFixed/PopinFixedHeader.jsx'
6 6
 import PopinFixedOption from './component/PopinFixed/PopinFixedOption.jsx'
7 7
 import PopinFixedContent from './component/PopinFixed/PopinFixedContent.jsx'
8 8
 
9
-import TextAreaPlugin from './component/Input/TextAreaPlugin.jsx'
9
+import TextAreaPlugin from './component/Input/TextAreaPlugin/TextAreaPlugin.jsx'
10
+import BtnSwitch from './component/Input/BtnSwitch/BtnSwitch.jsx'
10 11
 
11 12
 import Timeline from './component/Timeline/Timeline.jsx'
12 13
 
@@ -19,6 +20,8 @@ ReactDOM.render(
19 20
       onClickCloseBtn={() => {}}
20 21
     />
21 22
 
23
+    <BtnSwitch />
24
+
22 25
     <PopinFixedOption customClass={`${'randomClass'}`} />
23 26
 
24 27
     <PopinFixedContent customClass={`${'randomClass'}__contentpage`}>

+ 3 - 1
src/index.js View File

@@ -5,7 +5,8 @@ import libPopinFixedContent from './component/PopinFixed/PopinFixedContent.jsx'
5 5
 
6 6
 import libTimeline from './component/Timeline/Timeline.jsx'
7 7
 
8
-import libTextAreaPlugin from './component/Input/TextAreaPlugin.jsx'
8
+import libTextAreaPlugin from './component/Input/TextAreaPlugin/TextAreaPlugin.jsx'
9
+import libBtnSwitch from './component/Input/BtnSwitch/BtnSwitch.jsx'
9 10
 
10 11
 export const PopinFixed = libPopinFixed
11 12
 export const PopinFixedHeader = libPopinFixedHeader
@@ -15,3 +16,4 @@ export const PopinFixedContent = libPopinFixedContent
15 16
 export const Timeline = libTimeline
16 17
 
17 18
 export const TextAreaPlugin = libTextAreaPlugin
19
+export const BtnSwitch = libBtnSwitch