mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
Add clamp-with-max & size-clamp sass functions
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": 1711466115649
|
||||
"version": 1711467668591
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
// Settings
|
||||
// ==========================================================================
|
||||
|
||||
@import "settings/config";
|
||||
@import "settings/config.breakpoints";
|
||||
@import "settings/config.colors";
|
||||
@import "settings/config.eases";
|
||||
@@ -27,7 +28,6 @@
|
||||
@import "settings/config.spacers";
|
||||
@import "settings/config.timings";
|
||||
@import "settings/config.zindexes";
|
||||
@import "settings/config";
|
||||
@import "settings/config.variables";
|
||||
|
||||
// Generic
|
||||
|
||||
@@ -34,6 +34,7 @@ $easing: ease("power2.out");
|
||||
// =============================================================================
|
||||
$unit: 60px;
|
||||
$unit-small: 20px;
|
||||
$vw-viewport: 1440;
|
||||
|
||||
// Container
|
||||
// ==========================================================================
|
||||
|
||||
@@ -33,14 +33,14 @@
|
||||
|
||||
$spacers: (
|
||||
'gutter': var(--grid-gutter),
|
||||
'2xs': #{spacingClamp('2xs')},
|
||||
'xs': #{spacingClamp('xs')},
|
||||
'sm': #{spacingClamp('sm')},
|
||||
'md': #{spacingClamp('md')},
|
||||
'lg': #{spacingClamp('lg')},
|
||||
'xl': #{spacingClamp('xl')},
|
||||
'2xl': #{spacingClamp('2xl')},
|
||||
'3xl': #{spacingClamp('3xl')},
|
||||
'2xs': #{size-clamp('2xs')},
|
||||
'xs': #{size-clamp('xs')},
|
||||
'sm': #{size-clamp('sm')},
|
||||
'md': #{size-clamp('md')},
|
||||
'lg': #{size-clamp('lg')},
|
||||
'xl': #{size-clamp('xl')},
|
||||
'2xl': #{size-clamp('2xl')},
|
||||
'3xl': #{size-clamp('3xl')},
|
||||
);
|
||||
|
||||
// Function
|
||||
|
||||
@@ -178,6 +178,19 @@ $context: 'frontend' !default;
|
||||
@return calc(#{$number} * var(--vw, 1vw));
|
||||
}
|
||||
|
||||
@function clamp-with-max($min, $size, $max) {
|
||||
$vw-context: $vw-viewport * 0.01;
|
||||
@return clamp(#{$min}, calc(#{$size} / #{$vw-context} * 1vw), #{$max});
|
||||
}
|
||||
|
||||
@function size-clamp($size) {
|
||||
@return clamp-with-max(
|
||||
calc(#{rem(1px)} * var(--spacing-#{$size}-mobile)),
|
||||
var(--spacing-#{$size}-desktop),
|
||||
calc(#{rem(1px)} * var(--spacing-#{$size}-desktop))
|
||||
);
|
||||
}
|
||||
|
||||
// Returns clamp of calculated preferred responsive font size
|
||||
// within a font size and breakpoint range.
|
||||
//
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user