-
Notifications
You must be signed in to change notification settings - Fork 11
Layout gap value list support #12
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
Merged
philmtd
merged 6 commits into
philmtd:master
from
Salesflare:layout-gap-value-list-support
Feb 17, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
db9f25c
fix(layout): added support for gap value list
lievenjanssen a511f70
fix(layout): added test for gap value list
lievenjanssen b8b308d
fix(layout): remove unnecessary mixin forwards for gap
lievenjanssen caf7fe5
fix(layout): updated documentation for layout gap mixins
lievenjanssen c09b2bf
fix(api): forward mixins
lievenjanssen cff4e91
fix(layout): created seperate functions for value list support
lievenjanssen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
@forward './src/fxlayout' show class-selectors, | ||
@forward "./src/fxlayout" show class-selectors, | ||
gap-class-selectors, | ||
gap-class-selectors-from-list, | ||
attribute-selectors, | ||
gap-attribute-selectors; | ||
gap-attribute-selectors, | ||
gap-attribute-selectors-from-list; | ||
|
||
@forward "./src/lib/mixins" hide layout-gap-attributes, | ||
layout-gap-classes; | ||
@forward "./src/lib/mixins"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
@use "sass:list"; | ||
|
||
@import "mixins"; | ||
|
||
/// Includes selectors for attributes which can be used to add a specific gap to elements in a flex container | ||
/// | ||
/// @param {number} $value | ||
/// Will start generating selectors for $value $gapUnits | ||
/// @param {string} $gapUnits | ||
/// Will generate selectors for the units passed in $gapUnits, e.g. px em rem | ||
/// @param {string} $name | ||
/// Will generate selectors for a specific media size, e.g. xs, sm, md, ... | ||
@mixin layout-gap-attribute($value, $gapUnits, $name: false) { | ||
@each $unit in $gapUnits { | ||
*[data-layout-gap#{if($name, '-' + $name, '')}="#{$value}#{$unit}"] { | ||
gap: #{$value}#{$unit}; | ||
} | ||
} | ||
} | ||
|
||
/// Includes selectors for attributes which can be used to add a gap to elements in a flex container | ||
/// | ||
/// @param {number} $from | ||
/// Will start generating selectors from $from $gapUnits | ||
/// @param {number} $to | ||
/// Will generate selectors until including $to $gapUnits | ||
/// @param {string} $gapUnits | ||
/// Will generate selectors for the units passed in $gapUnits, e.g. px em rem | ||
/// @param {bool} $includeSelectorsForMediaSizes | ||
/// Will generate additional selectors for flex layout media sizes | ||
@mixin layout-gap-attributes($from: 1, $to: 24, $gapUnits: px em rem, $includeSelectorsForMediaSizes: true) { | ||
lievenjanssen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@for $i from $from through $to { | ||
@include layout-gap-attribute($i, $gapUnits) | ||
} | ||
@if $includeSelectorsForMediaSizes { | ||
@each $name, $_ in $flex-layout-media-queries { | ||
@include flex-layout-media($name) { | ||
@for $i from $from through $to { | ||
@include layout-gap-attribute($i, $gapUnits, $name) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
/// Includes selectors for attributes based on a list of values which can be used to add a gap to elements in a flex container | ||
/// | ||
/// @param {number} $values | ||
/// Will generate selectors for every value in $values list | ||
/// @param {string} $gapUnits | ||
/// Will generate selectors for the units passed in $gapUnits, e.g. px em rem | ||
/// @param {bool} $includeSelectorsForMediaSizes | ||
/// Will generate additional selectors for flex layout media sizes | ||
@mixin layout-gap-attributes-from-list($values: 4 8 16, $gapUnits: px em rem, $includeSelectorsForMediaSizes: true) { | ||
@each $value in $values { | ||
@include layout-gap-attribute($value, $gapUnits) | ||
} | ||
@if $includeSelectorsForMediaSizes { | ||
@each $name, $_ in $flex-layout-media-queries { | ||
@include flex-layout-media($name) { | ||
@each $value in $values { | ||
@include layout-gap-attribute($value, $gapUnits, $name) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
@use "sass:list"; | ||
|
||
@import "mixins"; | ||
|
||
/// Includes selectors for classes which can be used to add a specific gap to elements in a flex container | ||
/// | ||
/// @param {number} $value | ||
/// Will start generating selectors for $value $gapUnits | ||
/// @param {string} $gapUnits | ||
/// Will generate selectors for the units passed in $gapUnits, e.g. px em rem | ||
/// @param {string} $name | ||
/// Will generate selectors for a specific media size, e.g. xs, sm, md, ... | ||
@mixin layout-gap-class($value, $gapUnits, $name: false) { | ||
@each $unit in $gapUnits { | ||
*.fx-gap--#{$value}#{$unit}#{if($name, '--' + $name, '')} { | ||
gap: #{$value}#{$unit}; | ||
} | ||
} | ||
}; | ||
|
||
/// Includes selectors for classes which can be used to add a gap to elements in a flex container | ||
/// | ||
/// @param {number} $from | ||
/// Will start generating selectors from $from $gapUnits | ||
/// @param {number} $to | ||
/// Will generate selectors until including $to $gapUnits | ||
/// @param {string} $gapUnits | ||
/// Will generate selectors for the units passed in $gapUnits, e.g. px em rem | ||
/// @param {bool} $includeSelectorsForMediaSizes | ||
/// Will generate additional selectors for flex layout media sizes | ||
@mixin layout-gap-classes($from: 1, $to: 24, $gapUnits: px em rem, $includeSelectorsForMediaSizes: true) { | ||
@for $i from $from through $to { | ||
@include layout-gap-class($i, $gapUnits) | ||
} | ||
@if $includeSelectorsForMediaSizes { | ||
@each $name, $_ in $flex-layout-media-queries { | ||
@include flex-layout-media($name) { | ||
@for $i from $from through $to { | ||
@include layout-gap-class($i, $gapUnits, $name) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
/// Includes selectors for classes based on a list of values which can be used to add a gap to elements in a flex container | ||
/// | ||
/// @param {number} $values | ||
/// Will generate selectors for every value in $values list | ||
/// @param {string} $gapUnits | ||
/// Will generate selectors for the units passed in $gapUnits, e.g. px em rem | ||
/// @param {bool} $includeSelectorsForMediaSizes | ||
/// Will generate additional selectors for flex layout media sizes | ||
@mixin layout-gap-classes-from-list($values: 4 8 16, $gapUnits: px em rem, $includeSelectorsForMediaSizes: true) { | ||
@each $value in $values { | ||
@include layout-gap-class($value, $gapUnits) | ||
} | ||
@if $includeSelectorsForMediaSizes { | ||
@each $name, $_ in $flex-layout-media-queries { | ||
@include flex-layout-media($name) { | ||
@each $value in $values { | ||
@include layout-gap-class($value, $gapUnits, $name) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.