Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update outline() and overflow-[xy]() mixins #3012

Merged
merged 5 commits into from Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
70 changes: 51 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/stylesheets/core/_properties.scss
Expand Up @@ -501,7 +501,9 @@ $system-properties: (
standard: map-collect(
map-get($system-spacing, 'smaller'),
map-get($partial-values, 'zero-zero'),
('05': spacing-multiple(0.5))
(
'05': spacing-multiple(0.5),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrote this in expanded format to better accept new custom values if we decide to accept, say, 1 unit

)
),
extended: (),
),
Expand Down
11 changes: 9 additions & 2 deletions src/stylesheets/core/mixins/utilities/_outline.scss
@@ -1,19 +1,26 @@
// Outputs a solid outline of $value... width
@mixin u-outline($value...) {
$important: null;
$widths: map-deep-get($system-properties, outline, standard);
@if has-important($value) {
$value: remove($value, '!important');
$important: ' !important';
}
@each $this-value in $value {
$this-value: smart-quote($this-value);
$match: false;
@if map-has-key($all-color-shortcodes, smart-quote($this-value)) {
@if map-has-key($all-color-shortcodes, $this-value) {
$match: true;
outline-color: color(smart-quote($this-value)) #{$important};
}
@else if map-has-key($widths, $this-value) {
$match: true;
$final-value: map-get($widths, $this-value);
outline-width: unquote('#{$final-value}#{$important}');
outline-style: solid#{$important};
}
@else if type-of($this-value) == 'number' {
$converted-value: number-to-token($this-value);
$widths: map-deep-get($system-properties, outline, standard);
@if map-has-key($widths, $converted-value) {
$match: true;
$final-value: map-get($widths, $converted-value);
Expand Down
18 changes: 18 additions & 0 deletions src/stylesheets/core/mixins/utilities/_overflow.scss
Expand Up @@ -8,3 +8,21 @@
}
overflow: get-uswds-value(overflow, $value...) #{$important};
}

@mixin u-overflow-x($value...) {
$important: null;
@if has-important($value) {
$value: remove($value, '!important');
$important: ' !important';
}
overflow-x: get-uswds-value(overflow, $value...) #{$important};
}

@mixin u-overflow-y($value...) {
$important: null;
@if has-important($value) {
$value: remove($value, '!important');
$important: ' !important';
}
overflow-y: get-uswds-value(overflow, $value...) #{$important};
}