forked from GetmeUK/ContentTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_ignition.scss
More file actions
174 lines (142 loc) · 4.37 KB
/
Copy path_ignition.scss
File metadata and controls
174 lines (142 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/**
* The ignition switch is how users start and stop editing the page.
*/
/**
* If the app is performing a remote task that requires the user to wait for
* a response from the server then the ignition may be set to a busy state. The
* busy state uses an animation (a rotating cog) defined below.
*/
@include keyframes(busy-ignition) {
0% {
transform: rotate(0deg);
@include transform(transform);
}
100% {
transform: rotate(359deg);
@include transform(transform);
}
}
@mixin animation--busy-ignition() {
@include animation(busy-ignition 5s linear);
@include animation-iteration-count(infinite);
@include animation-fill-mode(forwards);
}
.ct-widget {
&.ct-ignition {
/**
* Position of the switch on the page
*/
left: 16px;
position: fixed;
top: 16px;
/**
* Depending on the current state of the switch we show either the edit
* button (page ready to edit), or the confirm and cancel buttons (
* page currently being edited).
*/
.ct-ignition__button {
display: none;
}
&--editing {
.ct-ignition__button--confirm,
.ct-ignition__button--cancel {
display: block;
}
}
&--ready {
.ct-ignition__button--edit {
display: block;
}
}
// Position here to ensure it supersedes `editing` and `ready` modifiers
&--busy {
.ct-ignition__button {
display: none;
&--busy {
display: block;
}
}
}
}
.ct-ignition {
/**
* The ignition switch is constructed of 3 buttons, edit, confirm and
* cancel.
*/
$buttonSize: 48px;
&__button {
// Set the base appeance of the button
border-radius: $buttonSize / 2;
content: '';
cursor: pointer;
display: block;
height: $buttonSize;
line-height: $buttonSize;
opacity: 0.9;
position: absolute;
text-align: center;
@include type-icons($font-size: 24px);
width: $buttonSize;
// Each button displays an icon
&:before {
color: white;
}
/* Busy button */
&--busy {
@include animation--busy-ignition();
background: $muted-action-color;
cursor: default;
&:before {
content: '\e994';
}
&:hover {
background: $muted-action-color;
}
}
/* Confirm button */
&--confirm {
background: $confirm-action-color;
&:before {
content: '\ea10';
}
&:hover {
background: lighten($confirm-action-color, 5%);
}
}
/* Cancel button */
&--cancel {
background: $cancel-action-color;
left: $buttonSize + 16;
&:before {
content: '\ea0f';
}
&:hover {
background: lighten($cancel-action-color, 5%);
}
}
/* Edit button */
&--edit {
$bkg-color: $edit-action-color;
background: $bkg-color;
/**
* Unlike the confirm and cancel buttons we rotate the edit
* button's pencil icon on mouse over to add a sense of
* purpose :)
*/
&:before {
content: '\e905';
@include transition-property(transform);
@include transition-duration(0.1s);
@include transition-timing-function(ease-in);
}
&:hover {
background: lighten($bkg-color, 5%);
&:before {
display: inline-block;
@include transform(rotate(-15deg));
}
}
}
} // __button
} // .ct-ignition
} // .ct-widget