chr 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/CONTRIBUTING.md +24 -0
- data/Gemfile +3 -0
- data/LICENSE.md +21 -0
- data/README.md +18 -0
- data/Rakefile +3 -0
- data/app/assets/javascripts/chr.coffee +41 -0
- data/app/assets/javascripts/chr/core/_chr.coffee +89 -0
- data/app/assets/javascripts/chr/core/_item.coffee +85 -0
- data/app/assets/javascripts/chr/core/_list.coffee +154 -0
- data/app/assets/javascripts/chr/core/_listReorder.coffee +70 -0
- data/app/assets/javascripts/chr/core/_listScroll.coffee +23 -0
- data/app/assets/javascripts/chr/core/_listSearch.coffee +28 -0
- data/app/assets/javascripts/chr/core/_module.coffee +98 -0
- data/app/assets/javascripts/chr/core/_utils.coffee +50 -0
- data/app/assets/javascripts/chr/core/_view.coffee +121 -0
- data/app/assets/javascripts/chr/form/_form.coffee +205 -0
- data/app/assets/javascripts/chr/form/_inputCheckbox.coffee +70 -0
- data/app/assets/javascripts/chr/form/_inputColor.coffee +35 -0
- data/app/assets/javascripts/chr/form/_inputFile.coffee +82 -0
- data/app/assets/javascripts/chr/form/_inputHidden.coffee +41 -0
- data/app/assets/javascripts/chr/form/_inputList.coffee +142 -0
- data/app/assets/javascripts/chr/form/_inputSelect.coffee +59 -0
- data/app/assets/javascripts/chr/form/_inputString.coffee +87 -0
- data/app/assets/javascripts/chr/form/_inputText.coffee +23 -0
- data/app/assets/javascripts/chr/form/_nestedForm.coffee +164 -0
- data/app/assets/javascripts/chr/store/_store.coffee +104 -0
- data/app/assets/javascripts/chr/store/_storeRails.coffee +167 -0
- data/app/assets/javascripts/chr/vendor/jquery.scrollparent.js +14 -0
- data/app/assets/javascripts/chr/vendor/jquery.textarea_autosize.js +55 -0
- data/app/assets/javascripts/chr/vendor/jquery.typeahead.js +1782 -0
- data/app/assets/javascripts/chr/vendor/slip.js +804 -0
- data/app/assets/stylesheets/_chr.scss +7 -0
- data/app/assets/stylesheets/core/_icons.scss +124 -0
- data/app/assets/stylesheets/core/_list.scss +44 -0
- data/app/assets/stylesheets/core/_main.scss +89 -0
- data/app/assets/stylesheets/core/_responsive.scss +41 -0
- data/app/assets/stylesheets/form/_form.scss +50 -0
- data/app/assets/stylesheets/form/_input_checkbox.scss +87 -0
- data/app/assets/stylesheets/form/_input_color.scss +10 -0
- data/app/assets/stylesheets/form/_input_file.scss +28 -0
- data/app/assets/stylesheets/form/_input_list.scss +36 -0
- data/app/assets/stylesheets/form/_input_string.scss +8 -0
- data/app/assets/stylesheets/form/_input_text.scss +48 -0
- data/app/assets/stylesheets/form/_nested_form.scss +26 -0
- data/chr.gemspec +34 -0
- data/lib/chr.rb +15 -0
- data/lib/chr/engine.rb +5 -0
- data/lib/chr/version.rb +3 -0
- metadata +152 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
@mixin rotate($deg) {
|
|
2
|
+
-webkit-transform:rotate($deg * 1deg);
|
|
3
|
+
-moz-transform:rotate($deg * 1deg);
|
|
4
|
+
-ms-transform:rotate($deg * 1deg);
|
|
5
|
+
-o-transform:rotate($deg * 1deg);
|
|
6
|
+
transform:rotate($deg * 1deg);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.icon-base {
|
|
10
|
+
display: block;
|
|
11
|
+
width: 40px;
|
|
12
|
+
height: 40px;
|
|
13
|
+
&:after, &:before {
|
|
14
|
+
content:"";
|
|
15
|
+
position:absolute;
|
|
16
|
+
top:50%;
|
|
17
|
+
left:0;
|
|
18
|
+
background: $positiveColor;
|
|
19
|
+
}
|
|
20
|
+
&:hover { &:after, &:before { opacity: .5; } }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.icon-plus { @extend .icon-base;
|
|
24
|
+
&:before {
|
|
25
|
+
left:19px;
|
|
26
|
+
width:2px;
|
|
27
|
+
height:20px;
|
|
28
|
+
margin-top:-10px;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
&:after {
|
|
32
|
+
left:10px;
|
|
33
|
+
width:20px;
|
|
34
|
+
height:2px;
|
|
35
|
+
margin-top:-1px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.icon-arrow-left { @extend .icon-base;
|
|
40
|
+
&:after,
|
|
41
|
+
&:before { left:8px; width:14px; height:2px; }
|
|
42
|
+
|
|
43
|
+
&:before { margin-top: 4px; @include rotate(45); }
|
|
44
|
+
&:after { margin-top: -5px; @include rotate(-45); }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.icon-back {
|
|
48
|
+
display: block;
|
|
49
|
+
width: 40px;
|
|
50
|
+
line-height: 42px;
|
|
51
|
+
|
|
52
|
+
&:before {
|
|
53
|
+
content: '';
|
|
54
|
+
display: inline-block;
|
|
55
|
+
vertical-align: middle;
|
|
56
|
+
background-size: 100% auto;
|
|
57
|
+
background-position: center;
|
|
58
|
+
background-repeat: no-repeat;
|
|
59
|
+
font-style: normal;
|
|
60
|
+
position: relative;
|
|
61
|
+
width: 12px;
|
|
62
|
+
height: 20px;
|
|
63
|
+
margin-top: -4px;
|
|
64
|
+
background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'><path d='M10,0l2,2l-8,8l8,8l-2,2L0,10L10,0z' fill='%23007aff'/></svg>");
|
|
65
|
+
}
|
|
66
|
+
&:hover { opacity: .5; }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.icon-folder { @extend .icon-base;
|
|
70
|
+
position: absolute;
|
|
71
|
+
top: 50%;
|
|
72
|
+
margin-top: -20px;
|
|
73
|
+
right: 0;
|
|
74
|
+
&:after,
|
|
75
|
+
&:before { left:20px; width:10px; height:2px; background: $contrastColor; }
|
|
76
|
+
|
|
77
|
+
&:before { margin-top: 2px; @include rotate(-45); }
|
|
78
|
+
&:after { margin-top: -4px; @include rotate(45); }
|
|
79
|
+
&:hover { &:after, &:before { opacity: 1; } }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.icon-search {
|
|
83
|
+
display: block;
|
|
84
|
+
width: 40px;
|
|
85
|
+
height: 40px;
|
|
86
|
+
|
|
87
|
+
&:before {
|
|
88
|
+
content:"";
|
|
89
|
+
position:absolute;
|
|
90
|
+
top: 11px;
|
|
91
|
+
left: 10px;
|
|
92
|
+
border: 1px solid $positiveColor;
|
|
93
|
+
width: 14px;
|
|
94
|
+
height: 14px;
|
|
95
|
+
border-radius: 7px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:after {
|
|
99
|
+
content:"";
|
|
100
|
+
position:absolute;
|
|
101
|
+
@include rotate(-43);
|
|
102
|
+
width: 2px;
|
|
103
|
+
height: 8px;
|
|
104
|
+
left: 23px;
|
|
105
|
+
top: 21px;
|
|
106
|
+
background-color: $positiveColor;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&:hover { opacity: .5; }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.icon-reorder {
|
|
113
|
+
position: absolute; width: 40px; height: 40px;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
&:before,
|
|
116
|
+
&:after { content: ''; width: 20px; height: 2px; left: 10px; display: block; position: absolute; background-color: $contrastColor; }
|
|
117
|
+
&:before { top: 16px; }
|
|
118
|
+
&:after { top: 21px; }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.slip-reordering > .icon-reorder:before,
|
|
122
|
+
.slip-reordering > .icon-reorder:after { background-color: $positiveColor; }
|
|
123
|
+
|
|
124
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.list {
|
|
2
|
+
header {
|
|
3
|
+
.search {
|
|
4
|
+
@include absolutePosition(0 0 inherit inherit);
|
|
5
|
+
height: 40px; overflow: hidden; width: 40px;
|
|
6
|
+
|
|
7
|
+
.icon { @include absolutePosition(0 inherit inherit 0); z-index: 0; @extend .icon-search; }
|
|
8
|
+
input { display: none; height: 42px; width: 100%; padding: 0 5em 0 2.5em; outline-style: none; border: none; }
|
|
9
|
+
.cancel { display: none; @include absolutePosition(0 1em initial initial); z-index: 0; color: $positiveColor; }
|
|
10
|
+
}
|
|
11
|
+
.new + .search { @include absolutePosition(0 40px inherit inherit); }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&.list-search {
|
|
15
|
+
header {
|
|
16
|
+
.search { @include absolutePosition(0 0 inherit 0);
|
|
17
|
+
width: 100%; z-index: 1; background-color: $white;
|
|
18
|
+
input { display: block; }
|
|
19
|
+
.cancel { display: inline; &:hover { opacity: .5; } }
|
|
20
|
+
.icon {
|
|
21
|
+
&:hover { cursor: pointer; opacity: 1; }
|
|
22
|
+
&:before { border-color: $stableColor; }
|
|
23
|
+
&:after { background-color: $stableColor; }
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
.new + .search { @include absolutePosition(0 0 inherit 0); }
|
|
27
|
+
}
|
|
28
|
+
.item-folder { display: none; }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.items:after {
|
|
32
|
+
content: 'Loading...';
|
|
33
|
+
font-size: .8em; text-align: center; width: 100%; color: $stableColor; display: block; margin-top: 1.5em;
|
|
34
|
+
opacity: 0; @include transition(opacity .25s);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.list-loading .items:after {
|
|
38
|
+
opacity: 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* Generic ----------------------------------------------------------------- */
|
|
2
|
+
*, *:before, *:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
|
|
3
|
+
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
|
|
4
|
+
font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
|
|
5
|
+
a { text-decoration: none; }
|
|
6
|
+
}
|
|
7
|
+
html, body, .view { overflow: hidden; } // .module
|
|
8
|
+
|
|
9
|
+
/* Settings ---------------------------------------------------------------- */
|
|
10
|
+
$positiveColor: rgb( 74,135,238) !default;
|
|
11
|
+
$stableColor: rgb(178,178,178) !default;
|
|
12
|
+
$lightColor: rgb(210,210,210) !default;
|
|
13
|
+
$assertiveColor: rgb(239, 78, 58) !default;
|
|
14
|
+
$neutralColor: rgb(246,246,246) !default;
|
|
15
|
+
$contrastColor: rgb(230,230,230) !default;
|
|
16
|
+
$white: rgb(255,255,255) !default;
|
|
17
|
+
$black: #333 !default;
|
|
18
|
+
|
|
19
|
+
/* Mixins ------------------------------------------------------------------ */
|
|
20
|
+
@mixin absolutePosition($coordinates: null null null null) {
|
|
21
|
+
position: absolute; top: nth($coordinates, 1); right: nth($coordinates, 2); bottom: nth($coordinates, 3); left: nth($coordinates, 4); }
|
|
22
|
+
|
|
23
|
+
@mixin truncate {
|
|
24
|
+
text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
|
|
25
|
+
|
|
26
|
+
@mixin user-select-none {
|
|
27
|
+
-webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@mixin border($color) {
|
|
31
|
+
&:after { content: ''; display: block; height: 1px; //width: 100%;
|
|
32
|
+
background-color: $color; @include position(absolute, 0px 0px null 1em); }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@mixin noBorder { &:after { display: none; } }
|
|
36
|
+
|
|
37
|
+
@mixin customScrollbar {
|
|
38
|
+
&::-webkit-scrollbar { width: 6px; background-color: $neutralColor; }
|
|
39
|
+
&::-webkit-scrollbar-thumb { background-color: $contrastColor; border-radius: 3px; }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@mixin scrollable { overflow: hidden; overflow-y: scroll; -webkit-overflow-scrolling: touch; }
|
|
43
|
+
|
|
44
|
+
/* Imports ----------------------------------------------------------------- */
|
|
45
|
+
@import "icons";
|
|
46
|
+
@import "list";
|
|
47
|
+
|
|
48
|
+
/* Menu -------------------------------------------------------------------- */
|
|
49
|
+
.menu:before { content: 'CHR'; font-weight: 800; color: $contrastColor; line-height: 2.7;
|
|
50
|
+
position: absolute; display: block; margin-top: -2.7em; padding-left: 1em;
|
|
51
|
+
background-color: #fff; width: 100%; }
|
|
52
|
+
.menu { margin-top: 2.7em; font-size: .8em; letter-spacing: 1px; text-transform: uppercase; }
|
|
53
|
+
|
|
54
|
+
/* Headers ----------------------------------------------------------------- */
|
|
55
|
+
.view header,
|
|
56
|
+
.list header { text-align: center; position: relative; z-index: 1; line-height: 2.6; max-height: 42px; background-color: $white;
|
|
57
|
+
.title { font-weight: 500; padding: 1px 60px 0 40px; color: $black;
|
|
58
|
+
@include truncate; }
|
|
59
|
+
.back, .close { @include absolutePosition(0 inherit inherit 0); @extend .icon-back; overflow: hidden; height: 41px; }
|
|
60
|
+
.new { @include absolutePosition(0 0 inherit inherit); @extend .icon-plus; }
|
|
61
|
+
.save { @include absolutePosition(0 1em inherit inherit); color: $positiveColor; &:hover { opacity: .5; } }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Items ------------------------------------------------------------------- */
|
|
65
|
+
.items { @include absolutePosition(42px 0 0 0); @include scrollable(); padding-bottom: 5em; }
|
|
66
|
+
.menu a, .items .item {
|
|
67
|
+
display: block; position: relative;
|
|
68
|
+
padding: 1em; color: $black; @include border($neutralColor); margin-top: -1px;
|
|
69
|
+
&.active { background-color: $neutralColor; z-index: 1; }
|
|
70
|
+
&:first-child { @include noBorder(); }
|
|
71
|
+
}
|
|
72
|
+
.items .item {
|
|
73
|
+
&.has-subtitle { padding: .6em 1em; }
|
|
74
|
+
&.has-thumbnail { padding-left: 4.1em; }
|
|
75
|
+
&.has-thumbnail .item-title { line-height: 2.15; }
|
|
76
|
+
&.has-thumbnail.has-subtitle { padding-top: 1em; padding-bottom: .75em; }
|
|
77
|
+
&.has-thumbnail.has-subtitle .item-title { line-height: 1.2; }
|
|
78
|
+
&.reorderable { padding-right: 2.5em; }
|
|
79
|
+
.icon-reorder { top: 50%; margin-top: -20px; right: 0; }
|
|
80
|
+
}
|
|
81
|
+
.item-title { @include truncate; }
|
|
82
|
+
.item-subtitle { @include truncate; color: $stableColor; font-size: .8em; line-height: 1.5; }
|
|
83
|
+
.item-thumbnail { @include absolutePosition(.5em 0 0 .5em); width: 3.1em; height: 3.1em; }
|
|
84
|
+
.item-thumbnail img { width: 100%; border-radius: 25px; }
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* Layouts */
|
|
2
|
+
$tablet: "screen and (min-width:768px)";
|
|
3
|
+
$desktop: "screen and (min-width:1150px)";
|
|
4
|
+
|
|
5
|
+
/* Mobile Layout */
|
|
6
|
+
.sidebar { @include absolutePosition(0 0 0 0); z-index: 1; }
|
|
7
|
+
.module { @include absolutePosition(0 0 0 0); z-index: 2; }
|
|
8
|
+
.view { @include absolutePosition(0 0 0 0); z-index: 3; background-color: #fff; }
|
|
9
|
+
.list { @include absolutePosition(0 0 0 0); z-index: 0; overflow: hidden; background-color: #fff; }
|
|
10
|
+
|
|
11
|
+
/* Tablet Layout */
|
|
12
|
+
@media #{$tablet} {
|
|
13
|
+
.sidebar { right: inherit; width: 9em; }
|
|
14
|
+
.module { right: inherit; left: 9em; width: 20em; }
|
|
15
|
+
.view { left: 29em; }
|
|
16
|
+
.list { font-size: .9em; }
|
|
17
|
+
.items .item:active { background: $neutralColor; }
|
|
18
|
+
.module .list:first-child .back { display: none; }
|
|
19
|
+
.view header .close { @include absolutePosition(0 inherit inherit 1em); color: $positiveColor; &:before { display: none; } }
|
|
20
|
+
.view header .title { padding-left: 64px; }
|
|
21
|
+
.module, .view { box-shadow: 0 0 2px rgba(0, 0, 0, 0.2); }
|
|
22
|
+
.module {
|
|
23
|
+
&:after {
|
|
24
|
+
display: block; content: ''; width: 4px; @include position(absolute, 0px -3px 0px null);
|
|
25
|
+
background-color: $white; border-left: 1px solid $neutralColor;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// custom scrollbar
|
|
29
|
+
.redactor-editor, textarea.redactor, .view .input-stacked textarea, .view > form, .list .items { @include customScrollbar(); }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Desktop Layout */
|
|
33
|
+
@media #{$desktop} {
|
|
34
|
+
.sidebar { width: 10em; }
|
|
35
|
+
.module { left: 10em; width: 22em; }
|
|
36
|
+
.view { left: 32em; }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* Form -------------------------------------------------------------------- */
|
|
2
|
+
.view {
|
|
3
|
+
form { @include absolutePosition(42px 0 0 0); @include scrollable(); z-index: 0; padding-bottom: 5em; }
|
|
4
|
+
form { color: $black; }
|
|
5
|
+
label { display: block; }
|
|
6
|
+
|
|
7
|
+
.input-stacked {
|
|
8
|
+
@include position(relative); @include border($neutralColor); &:first-child { @include noBorder(); }
|
|
9
|
+
padding: .5em 1em .9em;
|
|
10
|
+
|
|
11
|
+
&.input-text { min-height: 82px; } // workaround for empty or oneline textareas
|
|
12
|
+
&.input-select select { margin-top: 0.15em; }
|
|
13
|
+
|
|
14
|
+
textarea { resize: none; overflow: auto; }
|
|
15
|
+
textarea { box-sizing: border-box; min-height: 20px; /* max-height: 400px; /* optional */ }
|
|
16
|
+
textarea,
|
|
17
|
+
input { outline-style: none; border: 0; width: 100%; @include placeholder { color: $lightColor; } }
|
|
18
|
+
.label { display: block; line-height: 1.8; color: $stableColor; }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.delete { display: block; text-align: center; margin: 5em 0; line-height: 2.5em;
|
|
22
|
+
color: $assertiveColor; border: 1px solid $assertiveColor; border-left: none; border-right: none;
|
|
23
|
+
&:hover, &:active { background-color: $assertiveColor; color: #fff; } }
|
|
24
|
+
|
|
25
|
+
.error-message { color: $assertiveColor; font-size: .8em; margin-left: .5em; }
|
|
26
|
+
|
|
27
|
+
&.view-saving {
|
|
28
|
+
header .save { display: none; }
|
|
29
|
+
header:after {
|
|
30
|
+
font-size: .8em;
|
|
31
|
+
content: 'Saving...';
|
|
32
|
+
opacity: .4;
|
|
33
|
+
@include absolutePosition(.4em .8em inherit inherit);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Imports --------------------------------------------------------------- */
|
|
38
|
+
@import "input_checkbox";
|
|
39
|
+
@import "input_color";
|
|
40
|
+
@import "input_file";
|
|
41
|
+
@import "input_list";
|
|
42
|
+
@import "input_string";
|
|
43
|
+
@import "input_text";
|
|
44
|
+
@import "nested_form";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* Checkbox ---------------------------------------------------------------- */
|
|
2
|
+
.input-checkbox {
|
|
3
|
+
padding: .8em 1em 1em;
|
|
4
|
+
|
|
5
|
+
input { display: inline; width: auto; margin-right: .5em; }
|
|
6
|
+
.label { display: inline; }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Switch ------------------------------------------------------------------ */
|
|
10
|
+
.input-switch { padding-top: .75em; }
|
|
11
|
+
.input-switch .switch {
|
|
12
|
+
float: right;
|
|
13
|
+
margin-top: -1.8em;
|
|
14
|
+
|
|
15
|
+
$switch-width: 52px;
|
|
16
|
+
$switch-padding: 2px;
|
|
17
|
+
$switch-height: 32px;
|
|
18
|
+
$switch-radius: $switch-height;
|
|
19
|
+
$knob-size: $switch-height - ($switch-padding * 2);
|
|
20
|
+
$knob-radius: $switch-height - ($switch-padding * 2);
|
|
21
|
+
$knob-width: $knob-size;
|
|
22
|
+
$switch-background: $white;
|
|
23
|
+
$switch-border-background: $contrastColor;
|
|
24
|
+
$switch-shadow: 0 0px 2px transparentize(black, 0.6);
|
|
25
|
+
|
|
26
|
+
border-radius: $switch-radius;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
display: inline-block;
|
|
29
|
+
height: $switch-height;
|
|
30
|
+
position: relative;
|
|
31
|
+
width: $switch-width;
|
|
32
|
+
|
|
33
|
+
input[type="checkbox"] {
|
|
34
|
+
display: none;
|
|
35
|
+
|
|
36
|
+
+ .checkbox {
|
|
37
|
+
@include transition(all 0.3s ease);
|
|
38
|
+
background: $switch-border-background;
|
|
39
|
+
border-radius: $switch-radius;
|
|
40
|
+
border: none;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
height: $switch-height;
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0;
|
|
45
|
+
position: relative;
|
|
46
|
+
width: $switch-width;
|
|
47
|
+
z-index: 0;
|
|
48
|
+
|
|
49
|
+
&:before {
|
|
50
|
+
@include position(absolute, 2px 0 0 2px);
|
|
51
|
+
@include transform(scale(1));
|
|
52
|
+
@include transition(all 0.3s ease);
|
|
53
|
+
background: $switch-background;
|
|
54
|
+
border-radius: $switch-radius;
|
|
55
|
+
content: "";
|
|
56
|
+
height: $knob-radius;
|
|
57
|
+
width: $switch-width - ($switch-padding * 2);
|
|
58
|
+
z-index: 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:after {
|
|
62
|
+
@include position(absolute, 2px 0 0 2px);
|
|
63
|
+
@include transition(all 0.3s ease);
|
|
64
|
+
@include size($knob-size);
|
|
65
|
+
background: $switch-background;
|
|
66
|
+
border-radius: $knob-radius;
|
|
67
|
+
box-shadow: $switch-shadow;
|
|
68
|
+
content: "";
|
|
69
|
+
z-index: 2;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:checked {
|
|
74
|
+
+ .checkbox {
|
|
75
|
+
background: $positiveColor;
|
|
76
|
+
|
|
77
|
+
&:before {
|
|
78
|
+
@include transform(scale(0));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:after {
|
|
82
|
+
left: $switch-width - $knob-width - ($switch-padding);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|