-
Notifications
You must be signed in to change notification settings - Fork 4
/
_buttons.scss
executable file
·180 lines (157 loc) · 3.81 KB
/
_buttons.scss
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
$include-button-css: true !default;
$button-color: $white !default;
$button-color-disabled: schema-color(1) !default;
$button-background: schema-color(3) !default;
$button-background-disabled: schema-color(2) !default;
$button-shadow-color: $miroschka !default;
$button-border-radius: $base-border-radius !default;
$button-padding: 0.5em 1em !default;
$button-sizes: (
small: $font-size-small,
medium: $base-font-size,
large: $font-size-large
) !default;
$button-shadows: (
normal: $paper-shadow-2,
hover: $paper-shadow-3,
active: none,
disabled: none
) !default;
/**
* Includes css for the general button styling
*/
@mixin button-base() {
font-family: $base-font-family;
-webkit-font-smoothing: antialiased;
font-weight: bold;
text-transform: uppercase;
text-decoration: none;
text-align: center;
line-height: 1rem;
user-select: none;
border: 1px solid transparent;
border-radius: $button-border-radius;
padding: $button-padding;
cursor: pointer;
display: inline-block;
vertical-align: middle;
white-space: nowrap;
outline: none;
@include appearance(none);
@include transition(all 0.2s);
}
/**
* Includes colors and shadows for buttons
* @param color $background
* @param color $color
* @param color $disabled-background
* @param color $disabled-color
*/
@mixin button-style($background, $color, $disabled-background: transparent, $disabled-color: transparent) {
background-color: $background;
color: $color;
box-shadow: map-get($button-shadows, normal);
&:hover,
&.is-hovered {
box-shadow: map-get($button-shadows, hover);
}
&:active,
&.is-active {
background-color: darken($background, 2%);
box-shadow: map-get($button-shadows, active);
}
&:disabled,
&.is-disabled {
cursor: not-allowed;
color: $disabled-color;
background-color: $disabled-background;
box-shadow: map-get($button-shadows, disabled);
}
}
/**
* Includes css to make a button small
*/
@mixin button-size-small() {
font-size: map-get($button-sizes, small);
line-height: map-get($button-sizes, small);
}
/**
* Includes css to make a button medium
*/
@mixin button-size-medium() {
font-size: map-get($button-sizes, medium);
line-height: map-get($button-sizes, medium);
}
/**
* Includes css to make a button large
*/
@mixin button-size-large() {
font-size: map-get($button-sizes, large);
line-height: map-get($button-sizes, large);
}
/**
* Includes css for a button of type toggle
*/
@mixin button-type-toggle() {
@include button-style($secondary-color, $asphalt, transparent, $ghost);
&:active,
&.is-active {
box-shadow: $paper-shadow-1;
color: $primary-color;
}
}
/**
* Includes css for a button of type flat
*/
@mixin button-type-flat() {
@include button-style(transparent, $primary-color, $catkin, $ghost);
box-shadow: none;
&:hover,
&.is-hovered {
box-shadow: $paper-shadow-2;
background-color: $catkin;
}
&:active,
&.is-active {
box-shadow: none;
background-color: $catkin;
}
}
@if $include-button-css {
.button,
button,
input[type='reset'],
input[type='button'],
input[type='submit'] {
@include button-base;
@include button-style($button-background, $button-color, $button-background-disabled, $button-color-disabled);
@include button-size-medium;
&.mod-large {
@include button-size-large;
}
&.mod-small {
@include button-size-small;
}
&.mod-secondary {
@include button-style($secondary-color, $asphalt, $silver, $ghost);
}
&.mod-toggle {
@include button-type-toggle;
}
&.mod-flat {
@include button-type-flat;
}
&.mod-collapse {
padding: 0;
}
}
.file-button {
font-weight: normal;
display: inline-block;
vertical-align: middle;
overflow: visible;
input[type='file'] {
display: none;
}
}
}