forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton.md.scss
More file actions
437 lines (303 loc) · 12.9 KB
/
button.md.scss
File metadata and controls
437 lines (303 loc) · 12.9 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
@import "../../themes/ionic.globals.md";
// Material Design Button
// --------------------------------------------------
/// @prop - Margin of the button
$button-md-margin: .4rem .2rem !default;
/// @prop - Padding of the button
$button-md-padding: 0 1.1em !default;
/// @prop - Height of the button
$button-md-height: 3.6rem !default;
/// @prop - Border radius of the button
$button-md-border-radius: 2px !default;
/// @prop - Font size of the button text
$button-md-font-size: 1.4rem !default;
/// @prop - Font weight of the button text
$button-md-font-weight: 500 !default;
/// @prop - Capitalization of the button text
$button-md-text-transform: uppercase !default;
/// @prop - Background color of the button
$button-md-background-color: color($colors-md, primary) !default;
/// @prop - Text color of the button
$button-md-text-color: color-contrast($colors-md, $button-md-background-color) !default;
/// @prop - Box shadow of the button
$button-md-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12) !default;
/// @prop - Duration of the transition of the button
$button-md-transition-duration: 300ms !default;
/// @prop - Speed curve of the transition of the button
$button-md-transition-timing-function: cubic-bezier(.4, 0, .2, 1) !default;
/// @prop - Background color of the button on hover
$button-md-background-color-hover: $button-md-background-color !default;
/// @prop - Background color of the activated button
$button-md-background-color-activated: color-shade($button-md-background-color) !default;
/// @prop - Opacity of the activated button
$button-md-opacity-activated: 1 !default;
/// @prop - Box shadow of the activated button
$button-md-box-shadow-activated: 0 3px 5px rgba(0, 0, 0, .14), 0 3px 5px rgba(0, 0, 0, .21) !default;
/// @prop - Background color of the ripple on the button
$button-md-ripple-background-color: #555 !default;
// Material Design Large Button
// --------------------------------------------------
/// @prop - Padding of the large button
$button-md-large-padding: 0 1em !default;
/// @prop - Height of the large button
$button-md-large-height: 2.8em !default;
/// @prop - Font size of the large button
$button-md-large-font-size: 2rem !default;
// Material Design Small Button
// --------------------------------------------------
/// @prop - Padding of the small button
$button-md-small-padding: 0 .9em !default;
/// @prop - Height of the small button
$button-md-small-height: 2.1em !default;
/// @prop - Font size of the small button
$button-md-small-font-size: 1.3rem !default;
/// @prop - Font size of an icon in the small button
$button-md-small-icon-font-size: 1.4em !default;
// Material Design Outline Button
// --------------------------------------------------
/// @prop - Border width of the outline button
$button-md-outline-border-width: 1px !default;
/// @prop - Border style of the outline button
$button-md-outline-border-style: solid !default;
/// @prop - Border color of the outline button
$button-md-outline-border-color: $button-md-background-color !default;
/// @prop - Text color of the outline button
$button-md-outline-text-color: $button-md-background-color !default;
/// @prop - Background color of the outline button
$button-md-outline-background-color: transparent !default;
/// @prop - Box shadow of the outline button
$button-md-outline-box-shadow: none !default;
/// @prop - Background color of the outline button on hover
$button-md-outline-background-color-hover: rgba(158, 158, 158, .1) !default;
/// @prop - Background color of the activated outline button
$button-md-outline-background-color-activated: transparent !default;
/// @prop - Box shadow of the activated outline button
$button-md-outline-box-shadow-activated: none !default;
/// @prop - Opacity of the activated outline button
$button-md-outline-opacity-activated: 1 !default;
/// @prop - Background color of the ripple on the outline button
$button-md-outline-ripple-background-color: $button-md-background-color !default;
// Material Design Clear Button
// --------------------------------------------------
/// @prop - Border color of the clear button
$button-md-clear-border-color: transparent !default;
/// @prop - Text color of the clear button
$button-md-clear-text-color: $button-md-background-color !default;
/// @prop - Background color of the clear button
$button-md-clear-background-color: transparent !default;
/// @prop - Box shadow of the clear button
$button-md-clear-box-shadow: none !default;
/// @prop - Opacity of the clear button
$button-md-clear-opacity: 1 !default;
/// @prop - Background color of the activated clear button
$button-md-clear-background-color-activated: rgba(158, 158, 158, .2) !default;
/// @prop - Box shadow of the activated clear button
$button-md-clear-box-shadow-activated: $button-md-clear-box-shadow !default;
/// @prop - Background color of the clear button on hover
$button-md-clear-background-color-hover: rgba(158, 158, 158, .1) !default;
/// @prop - Background color of the ripple on the clear button
$button-md-clear-ripple-background-color: #999 !default;
// Material Design Round Button
// --------------------------------------------------
/// @prop - Padding of the round button
$button-md-round-padding: $button-round-padding !default;
/// @prop - Border radius of the round button
$button-md-round-border-radius: $button-round-border-radius !default;
// Material Design FAB Button
// --------------------------------------------------
/// @prop - Border radius of the FAB button
$button-md-fab-border-radius: 50% !default;
/// @prop - Box shadow of the FAB button
$button-md-fab-box-shadow: 0 4px 6px 0 rgba(0, 0, 0, .14), 0 4px 5px rgba(0, 0, 0, .1) !default;
/// @prop - Box shadow of the activated FAB button
$button-md-fab-box-shadow-activated: 0 5px 15px 0 rgba(0, 0, 0, .4), 0 4px 7px 0 rgba(0, 0, 0, .1) !default;
// Material Design Default Button
// --------------------------------------------------
.button-md {
margin: $button-md-margin;
padding: $button-md-padding;
height: $button-md-height;
border-radius: $button-md-border-radius;
font-size: $button-md-font-size;
font-weight: $button-md-font-weight;
text-transform: $button-md-text-transform;
color: $button-md-text-color;
background-color: $button-md-background-color;
box-shadow: $button-md-box-shadow;
transition: box-shadow $button-md-transition-duration $button-md-transition-timing-function,
background-color $button-md-transition-duration $button-md-transition-timing-function,
color $button-md-transition-duration $button-md-transition-timing-function;
}
.button-md:hover:not(.disable-hover) {
background-color: $button-md-background-color-hover;
}
.button-md.activated {
background-color: $button-md-background-color-activated;
box-shadow: $button-md-box-shadow-activated;
}
.button-md .button-effect {
background-color: $button-md-text-color;
}
// Material Design Default Button Color Mixin
// --------------------------------------------------
@mixin md-button-default($color-name, $color-base, $color-contrast) {
$background-color: $color-base;
$background-color-activated: color-shade($background-color);
$fg-color: $color-contrast;
.button-md-#{$color-name} {
color: $fg-color;
background-color: $background-color;
}
.button-md-#{$color-name}:hover:not(.disable-hover) {
background-color: $background-color;
}
.button-md-#{$color-name}.activated {
background-color: $background-color-activated;
opacity: $button-md-opacity-activated;
}
.button-md-#{$color-name} .button-effect {
background-color: $fg-color;
}
}
// Material Design Button Sizes
// --------------------------------------------------
.button-large-md {
padding: $button-md-large-padding;
height: $button-md-large-height;
font-size: $button-md-large-font-size;
}
.button-small-md {
padding: $button-md-small-padding;
height: $button-md-small-height;
font-size: $button-md-small-font-size;
}
.button-small-md[icon-only] ion-icon {
font-size: $button-md-small-icon-font-size;
}
// Material Design Block Button
// --------------------------------------------------
.button-block-md {
margin-right: 0;
margin-left: 0;
}
// Material Design Full Button
// --------------------------------------------------
.button-full-md {
margin-right: 0;
margin-left: 0;
border-right-width: 0;
border-left-width: 0;
border-radius: 0;
}
// Material Design Outline Button
// --------------------------------------------------
.button-outline-md {
border-width: $button-md-outline-border-width;
border-style: $button-md-outline-border-style;
border-color: $button-md-outline-border-color;
color: $button-md-outline-text-color;
background-color: $button-md-outline-background-color;
box-shadow: $button-md-outline-box-shadow;
}
.button-outline-md:hover:not(.disable-hover) {
background-color: $button-md-outline-background-color-hover;
}
.button-outline-md.activated {
background-color: $button-md-outline-background-color-activated;
box-shadow: $button-md-outline-box-shadow-activated;
opacity: $button-md-outline-opacity-activated;
}
.button-outline-md .button-effect {
background-color: $button-md-outline-ripple-background-color;
}
// Material Design Outline Button Color Mixin
// --------------------------------------------------
@mixin md-button-outline($color-name, $color-base, $color-contrast) {
$fg-color: color-shade($color-base, 5%);
.button-outline-md-#{$color-name} {
border-color: $fg-color;
color: $fg-color;
background-color: $button-md-outline-background-color;
}
.button-outline-md-#{$color-name}:hover:not(.disable-hover) {
background-color: $button-md-outline-background-color-hover;
}
.button-outline-md-#{$color-name}.activated {
background-color: $button-md-outline-background-color-activated;
}
.button-outline-md-#{$color-name} .button-effect {
background-color: $fg-color;
}
}
// Material Design Clear Button
// --------------------------------------------------
.button-clear-md {
border-color: $button-md-clear-border-color;
color: $button-md-background-color;
background-color: $button-md-clear-background-color;
box-shadow: $button-md-clear-box-shadow;
opacity: $button-md-clear-opacity;
}
.button-clear-md.activated {
background-color: $button-md-clear-background-color-activated;
box-shadow: $button-md-clear-box-shadow-activated;
}
.button-clear-md:hover:not(.disable-hover) {
background-color: $button-md-clear-background-color-hover;
}
.button-clear-md .button-effect {
background-color: $button-md-clear-ripple-background-color;
}
// Material Design Clear Button Color Mixin
// --------------------------------------------------
@mixin md-button-clear($color-name, $color-base, $color-contrast) {
$fg-color: $color-base;
.button-clear-md-#{$color-name} {
border-color: $button-md-clear-border-color;
color: $fg-color;
background-color: $button-md-clear-background-color;
}
.button-clear-md-#{$color-name}.activated {
background-color: $button-md-clear-background-color-activated;
box-shadow: $button-md-clear-box-shadow-activated;
}
.button-clear-md-#{$color-name}:hover:not(.disable-hover) {
color: $fg-color;
}
}
// Material Design Round Button
// --------------------------------------------------
.button-round-md {
padding: $button-md-round-padding;
border-radius: $button-md-round-border-radius;
}
.button-md [icon-only] {
padding: 0;
}
// Material Design Ripple Effect
// --------------------------------------------------
// Only Material uses the button effect, so by default
// it's display none, and .md sets to display block.
.button-effect {
position: absolute;
top: 0;
left: 0;
z-index: 0;
display: none;
border-radius: 50%;
background-color: $button-md-ripple-background-color;
opacity: .2;
transform-origin: center center;
transition-timing-function: ease-in-out;
pointer-events: none;
}
.md .button-effect {
display: block;
}
// Generate Material Design Button Colors
// --------------------------------------------------
@each $color-name, $color-base, $color-contrast in get-colors($colors-md) {
@include md-button-default($color-name, $color-base, $color-contrast);
@include md-button-outline($color-name, $color-base, $color-contrast);
@include md-button-clear($color-name, $color-base, $color-contrast);
}