Mercurial > nebulaweb3
comparison default/assets/scss/vendors/bourbon/utilities/_collapse-directionals.scss @ 0:1d038bc9b3d2 default tip
Up:default
author | Liny <dev@neowd.com> |
---|---|
date | Sat, 31 May 2025 09:21:51 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1d038bc9b3d2 |
---|---|
1 @charset "UTF-8"; | |
2 | |
3 // scss-lint:disable ElsePlacement | |
4 | |
5 /// Directional-property mixins are shorthands for writing properties like | |
6 /// the following. | |
7 /// | |
8 /// @ignore You can also use `false` instead of `null`. | |
9 /// | |
10 /// @argument {list} $values | |
11 /// List of directional values. | |
12 /// | |
13 /// @example scss | |
14 /// .element { | |
15 /// @include border-style(dotted null); | |
16 /// @include margin(null 0 10px); | |
17 /// } | |
18 /// | |
19 /// // CSS Output | |
20 /// .element { | |
21 /// border-bottom-style: dotted; | |
22 /// border-top-style: dotted; | |
23 /// margin-bottom: 10px; | |
24 /// margin-left: 0; | |
25 /// margin-right: 0; | |
26 /// } | |
27 /// | |
28 /// @return {list} | |
29 /// | |
30 /// @access private | |
31 | |
32 @function _collapse-directionals($values) { | |
33 $output: null; | |
34 | |
35 $a: nth($values, 1); | |
36 $b: if(length($values) < 2, $a, nth($values, 2)); | |
37 $c: if(length($values) < 3, $a, nth($values, 3)); | |
38 $d: if(length($values) < 2, $a, nth($values, if(length($values) < 4, 2, 4))); | |
39 | |
40 @if $a == 0 { $a: 0; } | |
41 @if $b == 0 { $b: 0; } | |
42 @if $c == 0 { $c: 0; } | |
43 @if $d == 0 { $d: 0; } | |
44 | |
45 @if $a == $b and $a == $c and $a == $d { $output: $a; } | |
46 @else if $a == $c and $b == $d { $output: $a $b; } | |
47 @else if $b == $d { $output: $a $b $c; } | |
48 @else { $output: $a $b $c $d; } | |
49 | |
50 @return $output; | |
51 } |