UNPKG

11.2 kBSCSSView Raw
1@mixin reset-font() {
2 font-family: $font-family-base;
3 font-size: $font-size-body-1;
4 line-height: $font-lineheight-base;
5}
6
7// item尺寸
8// ----------------------------------------
9
10@mixin step-item-size(
11 $height: auto,
12 $width: auto,
13 $margin-left: 0,
14 $margin-right: 0
15) {
16 height: $height;
17 line-height: $height;
18 margin-left: $margin-left;
19 margin-right: $margin-right;
20}
21
22// item状态
23// ----------------------------------------
24
25@mixin step-item-state(
26 $shape: 'circle',
27 $background: $color-white,
28 $title-color: $color-black,
29 $icon-color: $color-black,
30 $tail-color: $color-black,
31 $tail-bg-color: $color-text1-1,
32 $icon-border-color: $color-black,
33 $content-color: $color-black,
34 $node-size: $s-8,
35 $font-weight: $font-weight-2
36) {
37 #{$step-prefix}-item-tail {
38 &-overlay {
39 background: $tail-color;
40 }
41
42 &-underlay {
43 background: $tail-bg-color;
44 }
45 }
46
47 & > #{$step-prefix}-item-container {
48 #{$step-prefix}-item-progress {
49 width: $node-size;
50 height: $node-size;
51 }
52
53 #{$step-prefix}-item-node {
54 color: $icon-color;
55 }
56
57 #{$step-prefix}-item-node-circle {
58 background: $background;
59 border-color: $icon-border-color;
60 }
61
62 #{$step-prefix}-item-node-dot {
63 background: $background;
64 border-color: $icon-border-color;
65 }
66 }
67
68 #{$step-prefix}-item-title {
69 color: $title-color;
70 word-break: break-word;
71 }
72 #{$step-prefix}-item-content {
73 color: $title-color;
74 font-size: $step-circle-item-content-font-size;
75 line-height: $font-lineheight-2;
76 word-break: break-word;
77 }
78
79 #{$step-prefix}-item-node-placeholder {
80 width: $node-size;
81 height: $node-size;
82 position: relative;
83 }
84
85 #{$step-prefix}-item-node {
86 position: relative;
87 display: inline-block;
88 text-align: center;
89 cursor: pointer;
90 &-circle {
91 display: block;
92 width: $node-size;
93 height: $node-size;
94 font-size: $step-circle-item-node-font-size;
95 font-weight: $font-weight;
96 line-height: calc(#{$node-size} - 2 * #{$step-circle-item-node-border-width});
97 text-align: center;
98 border: $step-circle-item-node-border-width solid;
99 border-radius: $step-circle-item-node-corner;
100 transition: background-color $motion-duration-immediately $motion-linear;
101 #{$step-icon-prefix} {
102 @include icon-size($step-circle-item-node-icon-size);
103 animation: zoomIn $motion-duration-standard $motion-linear;
104 }
105 }
106 }
107 @if ($shape == 'dot') {
108 #{$step-prefix}-item-content {
109 font-size: $step-dot-item-content-font-size;
110 }
111 #{$step-prefix}-item-node-dot {
112 display: block;
113 width: $node-size;
114 height: $node-size;
115 font-size: $step-dot-item-content-font-size;
116 line-height: calc(#{$node-size} - 2 * #{$step-dot-item-dot-border-width});
117 text-align: center;
118 border: $step-dot-item-dot-border-width solid;
119 border-radius: $step-dot-item-dot-corner;
120 transition: background-color .3s ease, border-color .3s ease;
121 }
122 }
123
124 @if ($shape == 'arrow') {
125 background: $background;
126
127 &:before {
128 border: $step-arrow-item-border-width solid $background;
129 border-left-color: transparent;
130 }
131
132 &:after {
133 border-left-color: $background;
134 }
135 }
136}
137
138// 针对不同size的节点进行样式调整
139
140@mixin state-node-size($type: 'hor', $shape: 'circle', $node-size: $s-8) {
141 @if ($type == 'hor') {
142 @if ($shape == 'circle') {
143 #{$step-prefix}-item-tail {
144 display: inline-block;
145 clear: both;
146 width: calc(100% - (#{$node-size} + 2 * #{$step-circle-item-node-padding}));
147 vertical-align: middle;
148 #{$step-prefix}-item-tail-underlay {
149 display: block;
150 height: $step-circle-item-tail-size;
151 position: relative;
152 }
153 #{$step-prefix}-item-tail-overlay {
154 position: absolute;
155 top: 0;
156 height: $step-circle-item-tail-size;
157 transition: all $motion-duration-immediately $motion-linear;
158 width: 100%;
159 }
160 }
161
162 & > #{$step-prefix}-item-body {
163 width: $step-circle-item-body-width;
164 left: calc(0px - (#{$step-circle-item-body-width} - #{$node-size} - #{$step-circle-item-node-padding} * 2) / 2);
165 text-align: center;
166 position: absolute;
167 & > #{$step-prefix}-item-title {
168 font-size: $step-circle-item-title-size;
169 line-height: calc(#{$step-circle-item-title-size} + 4px);
170 margin-top: $step-circle-item-title-margin-top;
171 font-weight: $step-circle-item-title-weight;
172 }
173 & > #{$step-prefix}-item-content {
174 margin-top: $step-circle-item-content-margin-top;
175 }
176 }
177 }
178 @if ($shape == 'dot') {
179 #{$step-prefix}-item-tail {
180 display: inline-block;
181 clear: both;
182 width: calc(100% - (#{$node-size} + 2 * #{$step-dot-item-dot-padding}));
183 vertical-align: middle;
184 #{$step-prefix}-item-tail-underlay {
185 display: block;
186 height: $step-dot-item-tail-size;
187 position: relative;
188 }
189 #{$step-prefix}-item-tail-overlay {
190 position: absolute;
191 top: 0;
192 height: $step-dot-item-tail-size;
193 transition: all $motion-duration-immediately $motion-linear;
194 width: 100%;
195 }
196 }
197
198 & > #{$step-prefix}-item-body {
199 width: $step-dot-item-body-width;
200 left: calc(0px - (#{$step-dot-item-body-width} - #{$node-size} - #{$step-dot-item-dot-padding} * 2) / 2);
201 text-align: center;
202 position: absolute;
203 & > #{$step-prefix}-item-title {
204 font-size: $step-dot-item-title-size;
205 line-height: calc(#{$step-dot-item-title-size} + 4px);
206 margin-top: $step-dot-item-title-margin-top;
207 font-weight: $step-dot-item-title-weight;
208 }
209 & > #{$step-prefix}-item-content {
210 margin-top: $step-dot-item-content-margin-top;
211 }
212 }
213 }
214 }
215
216 @if ($type == 'ver') {
217 @if ($shape == 'circle') {
218 #{$step-prefix}-item-tail {
219 width: $step-circle-vertical-item-tail-size;
220 height: 0;
221 margin: $step-circle-item-node-padding auto;
222 #{$step-prefix}-item-tail-underlay {
223 height: 100%;
224 width: $step-circle-vertical-item-tail-size;
225 position: relative;
226 }
227 #{$step-prefix}-item-tail-overlay {
228 position: absolute;
229 top: 0;
230 height: 100%;
231 width: $step-circle-vertical-item-tail-size;
232 }
233 }
234
235 & > #{$step-prefix}-item-body {
236 position: absolute;
237 top: 0;
238 left: calc(#{$node-size} / 2);
239 margin-left: $step-circle-item-node-padding;
240 & > #{$step-prefix}-item-title {
241 margin-top: $step-circle-vertical-item-title-margin-top;
242 text-align: left;
243 font-weight: $step-circle-item-title-weight;
244 @include reset-font;
245 }
246 & > #{$step-prefix}-item-content {
247 margin-top: $step-circle-vertical-item-content-margin-top;
248 min-height: $s-2;
249 text-align: left;
250 font-size: $step-circle-item-content-font-size;
251 line-height: $font-lineheight-2;
252 }
253 }
254 }
255
256 @if ($shape == 'dot') {
257 #{$step-prefix}-item-tail {
258 width: $step-dot-vertical-item-tail-size;
259 height: 0;
260 margin: $step-dot-item-dot-padding auto;
261 #{$step-prefix}-item-tail-underlay {
262 height: 100%;
263 width: $step-dot-vertical-item-tail-size;
264 position: relative;
265 }
266 #{$step-prefix}-item-tail-overlay {
267 position: absolute;
268 top: 0;
269 height: 100%;
270 width: $step-dot-vertical-item-tail-size;
271 }
272 }
273
274 & > #{$step-prefix}-item-body {
275 position: absolute;
276 top: 0;
277 left: calc(#{$node-size} / 2);
278 margin-left: $step-dot-item-dot-padding;
279 & > #{$step-prefix}-item-title {
280 margin-top: $step-dot-vertical-item-title-margin-top;
281 font-weight: $step-dot-item-title-weight;
282 text-align: left;
283 @include reset-font;
284 }
285 & > #{$step-prefix}-item-content {
286 margin-top: $step-dot-vertical-item-content-margin-top;
287 min-height: $s-2;
288 text-align: left;
289 font-size: $step-dot-item-content-font-size;
290 line-height: $font-lineheight-2;
291 }
292 }
293 }
294 }
295}
296
297@mixin label-placement($node-size: $s-8) {
298 // 横向布局支持content
299 #{$step-prefix}-item:last-child {
300 #{$step-prefix}-item-tail {
301 display: none;
302 }
303 }
304 #{$step-prefix}-item-body {
305 position: relative;
306 display: inline-block;
307 top: 0;
308 left: 0;
309 max-width: $step-circle-item-body-width;
310 overflow: hidden;
311 vertical-align: top;
312 text-align: left;
313 #{$step-prefix}-item-title {
314 display: inline-block;
315 padding-right: $step-circle-item-node-padding;
316 margin-top: calc(#{$node-size} / 2 - #{$step-circle-item-title-size} / 2);
317 }
318 }
319 #{$step-prefix}-item-tail {
320 width: calc(100% - (#{$node-size} + 2 * #{$step-circle-item-node-padding} + #{$step-circle-item-body-width}));
321 position: absolute;
322 right: 0;
323 margin-top: calc(0px - #{$step-circle-vertical-item-tail-size});
324 }
325}