2017-02-08 11:43:28 -05:00
|
|
|
// ==========================================================================
|
|
|
|
|
// Utilities / Spacing
|
|
|
|
|
// ==========================================================================
|
2016-12-18 15:45:44 -05:00
|
|
|
|
|
|
|
|
////
|
|
|
|
|
/// Utility classes to put specific spacing values onto elements. The below loop
|
|
|
|
|
/// will generate us a suite of classes like:
|
|
|
|
|
///
|
|
|
|
|
/// @example
|
|
|
|
|
/// .u-margin-top {}
|
2024-03-26 14:06:25 -04:00
|
|
|
/// .u-margin-top-xs {}
|
|
|
|
|
/// .u-padding-left-lg {}
|
|
|
|
|
/// .u-margin-right-sm {}
|
2016-12-18 15:45:44 -05:00
|
|
|
/// .u-padding {}
|
|
|
|
|
/// .u-padding-right-none {}
|
|
|
|
|
///
|
|
|
|
|
/// @link https://github.com/inuitcss/inuitcss/blob/512977a/utilities/_utilities.spacing.scss
|
|
|
|
|
////
|
|
|
|
|
|
|
|
|
|
/* stylelint-disable string-quotes */
|
|
|
|
|
|
|
|
|
|
$spacing-directions: (
|
|
|
|
|
null: null,
|
|
|
|
|
'-top': '-top',
|
|
|
|
|
'-right': '-right',
|
|
|
|
|
'-bottom': '-bottom',
|
|
|
|
|
'-left': '-left',
|
2023-06-15 17:28:29 +02:00
|
|
|
'-x': '-left' '-right',
|
|
|
|
|
'-y': '-top' '-bottom',
|
2016-12-18 15:45:44 -05:00
|
|
|
) !default;
|
|
|
|
|
|
|
|
|
|
$spacing-properties: (
|
|
|
|
|
'padding': 'padding',
|
|
|
|
|
'margin': 'margin',
|
|
|
|
|
) !default;
|
|
|
|
|
|
2024-03-26 14:06:25 -04:00
|
|
|
$spacing-sizes: join($spacings, (
|
2023-06-15 17:28:29 +02:00
|
|
|
null: var(--grid-gutter),
|
|
|
|
|
'none': 0
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
@each $breakpoint, $mediaquery in $breakpoints {
|
|
|
|
|
@each $property-namespace, $property in $spacing-properties {
|
2023-06-16 10:13:10 +02:00
|
|
|
@each $direction-namespace, $directions in $spacing-directions {
|
2023-06-15 17:28:29 +02:00
|
|
|
@each $size-namespace, $size in $spacing-sizes {
|
|
|
|
|
|
2023-06-16 10:13:10 +02:00
|
|
|
// Prepend "-" to spacing sizes if not null
|
|
|
|
|
$size-namespace: if($size-namespace != null, "-" + $size-namespace, $size-namespace);
|
|
|
|
|
|
|
|
|
|
// Base class
|
|
|
|
|
$base-class: ".u-" + #{$property-namespace}#{$direction-namespace}#{$size-namespace};
|
|
|
|
|
|
2024-03-26 14:06:25 -04:00
|
|
|
// Spacing without media query
|
2023-06-15 17:28:29 +02:00
|
|
|
@if $breakpoint == "tiny" {
|
2023-06-16 10:13:10 +02:00
|
|
|
#{$base-class} {
|
|
|
|
|
@each $direction in $directions {
|
2023-06-15 17:28:29 +02:00
|
|
|
#{$property}#{$direction}: $size !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-26 14:06:25 -04:00
|
|
|
// Spacing min-width breakpoints `@from-*`
|
2023-06-16 10:13:10 +02:00
|
|
|
#{$base-class}\@from-#{$breakpoint} {
|
2023-06-15 17:28:29 +02:00
|
|
|
@media #{mq-min($breakpoint)} {
|
2023-06-16 10:13:10 +02:00
|
|
|
@each $direction in $directions {
|
2023-06-15 17:28:29 +02:00
|
|
|
#{$property}#{$direction}: $size !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-12-18 15:45:44 -05:00
|
|
|
|
2024-03-26 14:06:25 -04:00
|
|
|
// Spacing max-width breakpoints @to-*`
|
2023-06-16 10:13:10 +02:00
|
|
|
#{$base-class}\@to-#{$breakpoint} {
|
2023-06-15 17:28:29 +02:00
|
|
|
@media #{mq-max($breakpoint)} {
|
2023-06-16 10:13:10 +02:00
|
|
|
@each $direction in $directions {
|
2023-06-15 17:28:29 +02:00
|
|
|
#{$property}#{$direction}: $size !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-12-18 15:45:44 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* stylelint-enable string-quotes */
|