dce4cd04d274eb8028db95dcd704f25d30a7488c
[lhc/web/wiklou.git] / resources / src / mediawiki.ui / components / default / buttons.less
1 @import "mediawiki.mixins";
2 @import "../../settings/typography";
3 @import "../../mixins/effects";
4 @import "../../mixins/utilities";
5
6 // Buttons
7 //
8 // All buttons start with mw-ui-button class, modified by other classes.
9 // It can be any element. Due to a lack of a CSS reset, the exact styling of
10 // the button depends on what type of element is used.
11 // There are two kinds of buttons, the default is a "Call to Action" with an obvious border
12 // and there is a quiet kind without a border.
13 //
14 // Styleguide 2.
15
16 @buttonBorderRadius: 3px;
17 @transitionDuration: .1s;
18 @transitionFunction: ease-in-out;
19
20 // Neutral button styling
21 //
22 // Markup:
23 // <button class="mw-ui-button">.mw-ui-button</button>
24 // <button class="mw-ui-button" disabled>.mw-ui-button</button>
25 //
26 // Styleguide 2.1.
27 .mw-ui-button {
28 // Container layout
29 display: inline-block;
30 padding: .5em 1em;
31 margin: 0;
32 .box-sizing(border-box);
33
34 // Disable weird iOS styling
35 -webkit-appearance: none;
36
37 // IE6/IE7 hack
38 // http://stackoverflow.com/a/5838575/365238
39 *display: inline;
40 zoom: 1;
41
42 // Container styling
43 .button-colors(@colorWhite);
44 border-radius: @buttonBorderRadius;
45
46 // Ensure that buttons and inputs are nicely aligned when they have differing heights
47 vertical-align: middle;
48
49 // Content styling
50 text-align: center;
51 font-weight: bold;
52
53 // Interaction styling
54 cursor: pointer;
55
56 &:disabled {
57 text-shadow: none;
58 cursor: default;
59 }
60
61 .transition(background @transitionDuration @transitionFunction, color @transitionDuration @transitionFunction, box-shadow @transitionDuration @transitionFunction;);
62
63 // Styling for specific button types
64 // -----------------------------------------
65
66 // Big buttons
67 //
68 // Not all buttons are equal. You can emphasise certain actions over others
69 // using the mw-ui-big class.
70 //
71 // Markup:
72 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
73 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
74 // <button class="mw-ui-button mw-ui-constructive mw-ui-big">.mw-ui-constructive</button>
75 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
76 //
77 // Styleguide 2.1.6.
78 &.mw-ui-big {
79 font-size: @baseFontSize * 1.3;
80 }
81
82 // Block buttons
83 //
84 // Some buttons might need to be stacked.
85 //
86 // Markup:
87 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
88 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
89 // <button class="mw-ui-button mw-ui-constructive mw-ui-block">.mw-ui-constructive</button>
90 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
91 //
92 // Styleguide 2.1.5.
93 &.mw-ui-block {
94 display: block;
95 width: 100%;
96 }
97
98 // Progressive buttons
99 //
100 // Use progressive buttons for actions which lead to a next step in the process.
101 // .mw-ui-primary is deprecated, kept for compatibility.
102 //
103 // Markup:
104 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
105 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
106 //
107 // Styleguide 2.1.1.
108 &.mw-ui-progressive,
109 &.mw-ui-primary {
110 .button-colors(@colorProgressive);
111
112 &.mw-ui-quiet {
113 .button-colors-quiet(@colorProgressive);
114 }
115 }
116
117 // Constructive buttons
118 //
119 // Use constructive buttons for actions which result in a final action in the process that results
120 // in a change of state.
121 // e.g. save changes button
122 //
123 // Markup:
124 // <button class="mw-ui-button mw-ui-constructive">.mw-ui-constructive</button>
125 // <button class="mw-ui-button mw-ui-constructive" disabled>.mw-ui-constructive</button>
126 //
127 // Styleguide 2.1.2.
128 &.mw-ui-constructive {
129 .button-colors(@colorConstructive);
130
131 &.mw-ui-quiet {
132 .button-colors-quiet(@colorConstructive);
133 }
134 }
135
136 // Destructive buttons
137 //
138 // Use destructive buttons for actions which result in the destruction of data.
139 // e.g. deleting a page.
140 // This should not be used for cancel buttons.
141 //
142 // Markup:
143 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
144 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
145 //
146 // Styleguide 2.1.3.
147 &.mw-ui-destructive {
148 .button-colors(@colorDestructive);
149
150 &.mw-ui-quiet {
151 .button-colors-quiet(@colorDestructive);
152 }
153 }
154
155 // Quiet buttons
156 //
157 // Use quiet buttons when they are less important and alongisde other progressive/destructive/progressive buttons.
158 //
159 // Markup:
160 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
161 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet">.mw-ui-constructive</button>
162 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet" disabled>.mw-ui-constructive</button>
163 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
164 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
165 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
166 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
167 //
168 // Styleguide 2.1.4.
169 &.mw-ui-quiet {
170 background: transparent;
171 border: none;
172 text-shadow: none;
173 .button-colors-quiet(@colorGrayDark);
174
175 &:hover,
176 &:focus {
177 box-shadow: none;
178 }
179
180 &:active,
181 &:disabled {
182 background: transparent;
183 }
184 }
185 }
186
187 a.mw-ui-button {
188 text-decoration: none;
189
190 // This overrides an underline declaration on a:hover and a:focus in
191 // commonElements.css, which the class alone isn't specific enough to do.
192 &:hover,
193 &:focus {
194 text-decoration: none;
195 }
196 }
197
198 // Button groups
199 //
200 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
201 //
202 // Markup:
203 // <div class="mw-ui-button-group">
204 // <div class="mw-ui-button">A</div>
205 // <div class="mw-ui-button">B</div>
206 // <div class="mw-ui-button">C</div>
207 // <div class="mw-ui-button">D</div>
208 // </div><div style="clear:both"></div>
209 //
210 // Styleguide 2.2.
211 .mw-ui-button-group > * {
212 border-radius: 0;
213 float: left;
214
215 &:first-child {
216 border-top-left-radius: @buttonBorderRadius;
217 border-bottom-left-radius: @buttonBorderRadius;
218 }
219
220 &:not(:first-child) {
221 border-left: none;
222 }
223
224 &:last-child{
225 border-top-right-radius: @buttonBorderRadius;
226 border-bottom-right-radius: @buttonBorderRadius;
227 }
228 }