-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Simplify responsive utilities with $responsive-variants #545
Merged
Merged
Changes from 18 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
f3c9bca
support empty string in breakpoint() mixin
shawnbot 92a2cef
add $responsive-variants map
shawnbot b632983
add docs for $responsive-variants
shawnbot 182cd2e
use $responsive-variants for .float-*
shawnbot 94748cf
use $responsive-variants and list for .d-*
shawnbot f3b8e57
use $responsive-variants for .direction-*
shawnbot 957e55c
use $responsive-variants in .border-*, .rounded-*;
shawnbot 2a8647f
add .rounded-<edge> utility docs
shawnbot cff39b5
line up border-color util parens
shawnbot 6bf88ce
use $responsive-variants for margin utils
shawnbot c73a52b
use $responsive-variants for padding utils
shawnbot ac762d2
fix #472
shawnbot 55cde57
remove variable interpolations in padding utils
shawnbot 3bdccf9
add caution bits for $responsive-variants
shawnbot 034e76a
nix unnecessary interpolations in comments
shawnbot 05c8d29
use $responsive-variants for flex utils
shawnbot 4b6cdb0
use $responsive-variants for .text-*
shawnbot 7341f7f
normalize whitespace
shawnbot 4124a31
update package-lock.json
shawnbot 6d5983f
Merge remote-tracking branch 'origin/master' into responsive-variants
shawnbot 314eeb4
move responsive border docs from marketing to core
shawnbot eea1415
[breaking] remove responsive borders from marketing-utilities
shawnbot 92fd60c
move responsive borders from marketing into primer-utilities
shawnbot 2ebc81a
Merge branch 'release-10.9.0' into responsive-variants
shawnbot 96d1e4f
make mx-auto responsive a la #577
shawnbot 9c312fb
Merge remote-tracking branch 'origin/release-10.9.0' into responsive-…
shawnbot 4c975aa
Update modules/primer-layout/lib/grid-offset.scss
957fa8b
rebuild package-lock
shawnbot 11fe822
Merge pull request #582 from primer/offset-is-important-v2
shawnbot 3173ad7
Merge remote-tracking branch 'origin/release-10.9.0' into responsive-…
shawnbot 6e98ed2
move links to the bottom
shawnbot 52f468c
update package-lock
shawnbot 4cfa9b8
Merge branch 'release-10.9.0' into responsive-variants
shawnbot 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 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 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 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 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 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 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,80 +1,52 @@ | ||
// Flex utility classes | ||
|
||
// stylelint-disable block-opening-brace-space-after, block-opening-brace-space-before | ||
// stylelint-disable comment-empty-line-before | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - | ||
// This is a template for generating the flex utility classes. | ||
// A version of each class will be generated without a breakpoint, | ||
// along with a variant for each breakpoint. | ||
// - - - - - - - - - - - - - - - - - - - - - - - | ||
|
||
@mixin flexUtility($breakpoint: 0) { | ||
|
||
// This is the breakpoint that will be inserted into class names | ||
$breakstring: -#{$breakpoint}; // example: `.d-sm-flex` | ||
|
||
// If there's no breakpoint, the $breakstring value will be blank. | ||
@if $breakpoint == 0 { | ||
$breakstring: ""; // example: `.d-flex` | ||
} | ||
|
||
// Flexbox classes | ||
// Container | ||
|
||
.flex#{$breakstring}-row { flex-direction: row !important; } | ||
.flex#{$breakstring}-row-reverse { flex-direction: row-reverse !important; } | ||
.flex#{$breakstring}-column { flex-direction: column !important; } | ||
|
||
.flex#{$breakstring}-wrap { flex-wrap: wrap !important; } | ||
.flex#{$breakstring}-nowrap { flex-wrap: nowrap !important; } | ||
|
||
.flex#{$breakstring}-justify-start { justify-content: flex-start !important; } | ||
.flex#{$breakstring}-justify-end { justify-content: flex-end !important; } | ||
.flex#{$breakstring}-justify-center { justify-content: center !important; } | ||
.flex#{$breakstring}-justify-between { justify-content: space-between !important; } | ||
.flex#{$breakstring}-justify-around { justify-content: space-around !important; } | ||
|
||
.flex#{$breakstring}-items-start { align-items: flex-start !important; } | ||
.flex#{$breakstring}-items-end { align-items: flex-end !important; } | ||
.flex#{$breakstring}-items-center { align-items: center !important; } | ||
.flex#{$breakstring}-items-baseline { align-items: baseline !important; } | ||
.flex#{$breakstring}-items-stretch { align-items: stretch !important; } | ||
|
||
.flex#{$breakstring}-content-start { align-content: flex-start !important; } | ||
.flex#{$breakstring}-content-end { align-content: flex-end !important; } | ||
.flex#{$breakstring}-content-center { align-content: center !important; } | ||
.flex#{$breakstring}-content-between { align-content: space-between !important; } | ||
.flex#{$breakstring}-content-around { align-content: space-around !important; } | ||
.flex#{$breakstring}-content-stretch { align-content: stretch !important; } | ||
|
||
// Item | ||
.flex#{$breakstring}-auto { flex: 1 1 auto !important; } | ||
.flex#{$breakstring}-shrink-0 { flex-shrink: 0 !important; } | ||
|
||
.flex#{$breakstring}-self-auto { align-self: auto !important; } | ||
.flex#{$breakstring}-self-start { align-self: flex-start !important; } | ||
.flex#{$breakstring}-self-end { align-self: flex-end !important; } | ||
.flex#{$breakstring}-self-center { align-self: center !important; } | ||
.flex#{$breakstring}-self-baseline { align-self: baseline !important; } | ||
.flex#{$breakstring}-self-stretch { align-self: stretch !important; } | ||
|
||
// Shorthand for equal width and height cols | ||
.flex#{$breakstring}-item-equal { | ||
flex-grow: 1; | ||
flex-basis: 0; | ||
} | ||
} | ||
|
||
// Generate basic flexbox classes | ||
@include flexUtility(); | ||
|
||
// Loop through the breakpoint values to create responsive classes | ||
@each $breakpoint in map-keys($breakpoints) { | ||
|
||
// Loop through the spacer values | ||
@each $breakpoint, $variant in $responsive-variants { | ||
@include breakpoint($breakpoint) { | ||
@include flexUtility($breakpoint); | ||
// Flexbox classes | ||
// Container | ||
.flex#{$variant}-row { flex-direction: row !important; } | ||
.flex#{$variant}-row-reverse { flex-direction: row-reverse !important; } | ||
.flex#{$variant}-column { flex-direction: column !important; } | ||
|
||
.flex#{$variant}-wrap { flex-wrap: wrap !important; } | ||
.flex#{$variant}-nowrap { flex-wrap: nowrap !important; } | ||
|
||
.flex#{$variant}-justify-start { justify-content: flex-start !important; } | ||
.flex#{$variant}-justify-end { justify-content: flex-end !important; } | ||
.flex#{$variant}-justify-center { justify-content: center !important; } | ||
.flex#{$variant}-justify-between { justify-content: space-between !important; } | ||
.flex#{$variant}-justify-around { justify-content: space-around !important; } | ||
|
||
.flex#{$variant}-items-start { align-items: flex-start !important; } | ||
.flex#{$variant}-items-end { align-items: flex-end !important; } | ||
.flex#{$variant}-items-center { align-items: center !important; } | ||
.flex#{$variant}-items-baseline { align-items: baseline !important; } | ||
.flex#{$variant}-items-stretch { align-items: stretch !important; } | ||
|
||
.flex#{$variant}-content-start { align-content: flex-start !important; } | ||
.flex#{$variant}-content-end { align-content: flex-end !important; } | ||
.flex#{$variant}-content-center { align-content: center !important; } | ||
.flex#{$variant}-content-between { align-content: space-between !important; } | ||
.flex#{$variant}-content-around { align-content: space-around !important; } | ||
.flex#{$variant}-content-stretch { align-content: stretch !important; } | ||
|
||
// Item | ||
.flex#{$variant}-auto { flex: 1 1 auto !important; } | ||
.flex#{$variant}-shrink-0 { flex-shrink: 0 !important; } | ||
|
||
.flex#{$variant}-self-auto { align-self: auto !important; } | ||
.flex#{$variant}-self-start { align-self: flex-start !important; } | ||
.flex#{$variant}-self-end { align-self: flex-end !important; } | ||
.flex#{$variant}-self-center { align-self: center !important; } | ||
.flex#{$variant}-self-baseline { align-self: baseline !important; } | ||
.flex#{$variant}-self-stretch { align-self: stretch !important; } | ||
|
||
// Shorthand for equal width and height cols | ||
.flex#{$variant}-item-equal { | ||
flex-grow: 1; | ||
flex-basis: 0; | ||
} | ||
} | ||
|
||
} |
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These docs should live in the contributing section of the style guide.