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
|
@use 'sass:list';
@use 'sass:map';
@use 'constants';
@use 'grid';
/**
* - size: sm, md, lg
* - direction: inline, block
*/
@function spacing($direction, $size, $breakpoint: initial) {
$factor: map.get(map.get(constants.$spacing-factor, $direction), $size);
@if list.index([xxl xl lg md sm], ($breakpoint)) {
@return grid.er-to-absolute($factor, $breakpoint);
} @else if $breakpoint == xs {
@return clamp(
spacing($direction, $size, initial),
grid.er-to-absolute($factor, xs),
spacing($direction, $size, sm)
);
} @else if $breakpoint == initial {
@return calc($factor * 0.0625rem);
}
@error "Invalid breakpoint: #{$breakpoint}";
}
|