Skip to content

Commit

Permalink
✨ feat(_size.scss): generate-classes-for-viewport should reuse logic …
Browse files Browse the repository at this point in the history
…from generate-classes-for-viewport-with-map
  • Loading branch information
Spiderpig86 committed Sep 28, 2022
1 parent 84fa95d commit 37c5f8e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
5 changes: 4 additions & 1 deletion dist/cirrus-all.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
)
)
);
*/
/*
Converts a list of properties to a mapping where the key and value are the property
itself.
*/
/*
Group selectors that share common styling.
Expand Down
5 changes: 4 additions & 1 deletion dist/cirrus-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
)
)
);
*/
/*
Converts a list of properties to a mapping where the key and value are the property
itself.
*/
/*
Group selectors that share common styling.
Expand Down
5 changes: 4 additions & 1 deletion dist/cirrus.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
)
)
);
*/
/*
Converts a list of properties to a mapping where the key and value are the property
itself.
*/
/*
Group selectors that share common styling.
Expand Down
29 changes: 9 additions & 20 deletions src/internal/_size.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use 'config';
@use 'functions';

/* Media Queries */
// TODO: For viewport mixins, future option to not fail if key not found and to ignore instead?
Expand Down Expand Up @@ -43,27 +44,15 @@
$generate-viewports: 'true',
$include-important: 'true'
) {
// We build in this order since we want larger viewports to have higher precedence
// so we can write classes like u-none u-block-md u-none-lg
$important: if($include-important == 'true', '!important', '');
$mapping: functions.to-property-map($classes);

@each $class in $classes {
.#{$prefix}#{$class} {
#{$property}: $class#{$important};
}
}

@if $generate-viewports == 'true' {
@each $suffix, $limit in config.$breakpoint-pairs {
@each $class in $classes {
@include screen-above($limit) {
.#{$prefix}#{$class}-#{$suffix} {
#{$property}: $class#{$important};
}
}
}
}
}
@include generate-classes-for-viewport-with-map(
$mapping,
$property,
$prefix,
$generate-viewports,
$include-important
);
}

/* Variant of mixin that takes in mapping of class name to value */
Expand Down

0 comments on commit 37c5f8e

Please sign in to comment.