-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(styles): tokenize the grid (#4045)
- Loading branch information
1 parent
4ced17b
commit baf61dc
Showing
16 changed files
with
133 additions
and
94 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-styles': patch | ||
--- | ||
|
||
Updated the grid padding and gutters. |
2 changes: 1 addition & 1 deletion
2
...s/internet-header/src/components/post-internet-breadcrumbs/post-internet-breadcrumbs.scss
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
2 changes: 1 addition & 1 deletion
2
packages/internet-header/src/components/post-internet-footer/post-internet-footer.scss
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 |
---|---|---|
|
@@ -6,4 +6,3 @@ | |
|
||
@use 'components/elevation'; | ||
@use 'components/sizing'; | ||
@use 'components/grid'; |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@use './mixins' as *; | ||
|
||
.row { | ||
@include make-row(); | ||
|
||
> * { | ||
@include make-col-ready(); | ||
} | ||
} | ||
|
||
@include make-grid-columns(); |
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
@use 'sass:map'; | ||
@use 'sass:math'; | ||
|
||
@use '../../functions/breakpoint'; | ||
@use '../../functions/tokens'; | ||
@use '../../mixins/media'; | ||
@use '../../tokens/components'; | ||
@use '../../variables/breakpoints'; | ||
|
||
@use './variables' as *; | ||
|
||
@mixin make-row() { | ||
display: flex; | ||
flex-wrap: wrap; | ||
|
||
margin-block-start: calc(-1 * var(--post-grid-gutter-y)); | ||
margin-inline: calc(-0.5 * var(--post-grid-gutter-x)); | ||
|
||
--post-grid-gutter-y: 0; | ||
@each $breakpoint in map.keys(breakpoints.$grid-breakpoints) { | ||
@include media.min($breakpoint) { | ||
--post-grid-gutter-x: #{tokens.get('grid-gutter-#{$breakpoint}', components.$post-container)}; | ||
} | ||
} | ||
} | ||
|
||
@mixin make-col-ready() { | ||
flex-shrink: 0; | ||
width: 100%; | ||
max-width: 100%; | ||
padding-inline: calc(var(--post-grid-gutter-x) * 0.5); | ||
margin-block-start: var(--post-grid-gutter-y); | ||
} | ||
|
||
@mixin make-col($size: false) { | ||
@if $size { | ||
flex: 0 0 auto; | ||
width: math.percentage(math.div($size, $grid-columns)); | ||
} @else { | ||
flex: 1 1 0; | ||
max-width: 100%; | ||
} | ||
} | ||
|
||
@mixin make-col-auto() { | ||
flex: 0 0 auto; | ||
width: auto; | ||
} | ||
|
||
@mixin make-col-offset($size) { | ||
$num: math.div($size, $grid-columns); | ||
margin-inline-start: if($num == 0, 0, math.percentage($num)); | ||
} | ||
|
||
@mixin row-cols($count) { | ||
> * { | ||
flex: 0 0 auto; | ||
width: math.percentage(math.div(1, $count)); | ||
} | ||
} | ||
|
||
@mixin make-grid-columns() { | ||
@each $breakpoint in map.keys(breakpoints.$grid-breakpoints) { | ||
$infix: breakpoint.infix($breakpoint); | ||
|
||
@include media.min($breakpoint) { | ||
.col#{$infix} { | ||
flex: 1 0 0%; | ||
} | ||
|
||
.row-cols#{$infix}-auto > * { | ||
@include make-col-auto(); | ||
} | ||
|
||
@if $grid-row-columns > 0 { | ||
@for $i from 1 through $grid-row-columns { | ||
.row-cols#{$infix}-#{$i} { | ||
@include row-cols($i); | ||
} | ||
} | ||
} | ||
|
||
.col#{$infix}-auto { | ||
@include make-col-auto(); | ||
} | ||
|
||
@if $grid-columns > 0 { | ||
@for $i from 1 through $grid-columns { | ||
.col#{$infix}-#{$i} { | ||
@include make-col($i); | ||
} | ||
} | ||
|
||
@for $i from 0 through ($grid-columns - 1) { | ||
@if not($infix == '' and $i == 0) { | ||
.offset#{$infix}-#{$i} { | ||
@include make-col-offset($i); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$grid-columns: 12; | ||
$grid-row-columns: 6; |
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 +1,2 @@ | ||
@forward './containers'; | ||
@forward './grid'; |
This file was deleted.
Oops, something went wrong.
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,2 +1 @@ | ||
@use './grid'; | ||
@use './subnavigation'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.