-
Notifications
You must be signed in to change notification settings - Fork 8
/
_objects.buttons.scss
166 lines (117 loc) · 3.98 KB
/
_objects.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
/*------------------------------------*\
#BUTTONS
\*------------------------------------*/
/**
* A simple button object.
*/
// Predefine the variables below in order to alter and enable specific features.
$inuit-btn-namespace: $inuit-namespace !default;
$inuit-btn-padding: halve($inuit-base-spacing-unit) !default;
$inuit-btn-padding--small: halve($inuit-btn-padding) !default;
$inuit-btn-padding--large: double($inuit-btn-padding) !default;
$inuit-btn-background: #4a8ec2 !default;
$inuit-btn-color: #fff !default;
$inuit-btn-border-width: 1px !default;
$inuit-btn-border-style: solid !default;
$inuit-btn-border-color: $inuit-btn-background !default;
$inuit-btn-radius: 0 !default;
$inuit-enable-btn--small: false !default;
$inuit-enable-btn--large: false !default;
$inuit-enable-btn--full: false !default;
$inuit-enable-btn--pill: false !default;
// Here we set a variable assuming that `box-sizing: border-box;` is not set
// globally. If it has been previously been defined, the following variable will
// be overriden and will be set to `true`.
$inuit-global-border-box: false !default;
/**
* 1. Allow us to style box model properties.
* 2. Line different sized buttons up a little nicer.
* 3. Make buttons inherit font styles (often necessary when styling `input`s as
* buttons).
* 4. Reset/normalize some styles.
* 5. Force all button-styled elements to appear clickable.
* 6. Fixes odd inner spacing in IE7.
* 7. Subtract the border size from the padding value so that buttons do not
* grow larger as we add borders.
*/
.#{$inuit-btn-namespace}btn,
%#{$inuit-btn-namespace}btn {
display: inline-block; /* [1] */
vertical-align: middle; /* [2] */
font: inherit; /* [3] */
text-align: center; /* [4] */
margin: 0; /* [4] */
cursor: pointer; /* [5] */
overflow: visible; /* [6] */
padding: $inuit-btn-padding - $inuit-btn-border-width double($inuit-btn-padding) - $inuit-btn-border-width; /* [7] */
background-color: $inuit-btn-background;
@if($inuit-btn-border-width != 0) {
border: $inuit-btn-border-width $inuit-btn-border-style $inuit-btn-border-color;
} @else {
border: none; /* [4] */
}
@if($inuit-btn-radius != 0) {
border-radius: $inuit-btn-radius;
}
&,
&:hover,
&:active,
&:focus {
text-decoration: none; /* [4] */
color: $inuit-btn-color;
}
}
/**
* Fix a Firefox bug whereby `input type="submit"` gains 2px extra padding.
*/
.#{$inuit-btn-namespace}btn::-moz-focus-inner,
%#{$inuit-btn-namespace}btn::-moz-focus-inner {
border: 0;
padding: 0;
}
@if ($inuit-enable-btn--small == true) {
/**
* Small buttons.
*/
.#{$inuit-btn-namespace}btn--small,
%#{$inuit-btn-namespace}btn--small {
padding: $inuit-btn-padding--small - $inuit-btn-border-width double($inuit-btn-padding--small) - $inuit-btn-border-width; /* [7] */
}
}
@if ($inuit-enable-btn--large == true) {
/**
* Large buttons.
*/
.#{$inuit-btn-namespace}btn--large,
%#{$inuit-btn-namespace}btn--large {
padding: $inuit-btn-padding--large - $inuit-btn-border-width double($inuit-btn-padding--large) - $inuit-btn-border-width; /* [7] */
}
}
@if ($inuit-enable-btn--full == true) {
/**
* Full-width buttons.
*/
.#{$inuit-btn-namespace}btn--full,
%#{$inuit-btn-namespace}btn--full {
width: 100%;
@if $inuit-global-border-box == false {
/**
* Remove paddings so that widths and paddings don’t conflict.
*/
padding-right: 0;
padding-left: 0;
}
}
}
@if ($inuit-enable-btn--pill == true) {
/**
* Round-ended buttons.
*
* 1. Overly-large value to ensure the radius rounds the whole end of the
* button.
*/
.#{$inuit-btn-namespace}btn--pill,
%#{$inuit-btn-namespace}btn--pill {
border-radius: 100px; /* [1] */
}
}