-
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): build grid from tokens
- Loading branch information
1 parent
ac68940
commit 74adfef
Showing
34 changed files
with
307 additions
and
714 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
packages/documentation/src/stories/foundation/layout/breakpoints.module.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@use '@swisspost/design-system-styles/core' as post; | ||
@use 'shared.module' as shared; | ||
|
||
:export { | ||
// Variables to expose under sass variables section | ||
@each $breakpoint, $value in post.$grid-breakpoints { | ||
variables_grid-breakpoints_#{$breakpoint}: $value; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/documentation/src/stories/foundation/layout/column.styles.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@use '@swisspost/design-system-styles/core' as post; | ||
|
||
@mixin column-styles { | ||
background: linear-gradient(lighten(post.$nightblue-bright, 55%), lighten(post.$nightblue-bright, 55%)), linear-gradient(lighten(post.$nightblue-bright, 60%), lighten(post.$nightblue-bright, 60%)); | ||
background-clip: content-box, border-box; | ||
border: 1px solid lighten(post.$nightblue-dark, 55%); | ||
line-height: 3; | ||
} |
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
15 changes: 6 additions & 9 deletions
15
packages/documentation/src/stories/foundation/layout/columns/columns.styles.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
@use '@swisspost/design-system-styles/core' as post; | ||
@use '../column.styles' as *; | ||
|
||
.column-example { | ||
font-size: post.$font-size-sm; | ||
|
||
.row > *:not(.w-100) { | ||
padding-block: 0.75rem; | ||
background-color: lighten(post.$nightblue-bright, 55%); | ||
border: 1px solid lighten(post.$nightblue-dark, 45%); | ||
@include column-styles; | ||
} | ||
|
||
.row { | ||
background-color: lighten(post.$nightblue-bright, 61.5%); | ||
background-color: lighten(post.$nightblue-bright, 63%); | ||
} | ||
|
||
.row-height { | ||
.row-height .row { | ||
min-height: 10rem; | ||
} | ||
|
||
.standalone-columns > *:not(p){ | ||
padding-block: 0.75rem; | ||
background-color: lighten(post.$nightblue-bright, 55%); | ||
border: 1px solid lighten(post.$nightblue-dark, 45%); | ||
@include column-styles; | ||
} | ||
} | ||
} |
37 changes: 0 additions & 37 deletions
37
packages/documentation/src/stories/foundation/layout/containers/containers.blocks.tsx
This file was deleted.
Oops, something went wrong.
43 changes: 15 additions & 28 deletions
43
...ages/documentation/src/stories/foundation/layout/containers/containers.docs.mdx
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,47 +1,34 @@ | ||
import { Meta, Source } from '@storybook/blocks'; | ||
import { formatAsMap } from '@/utils/sass-export'; | ||
import { ContainersTable, SCSS_VARIABLES } from './containers.blocks'; | ||
import * as ContainerStories from './containers.stories'; | ||
|
||
<Meta of={ContainerStories} /> | ||
|
||
# Containers | ||
|
||
<p className="lead">Containers are a fundamental building block of our Design-System that contain, pad, and align your content within a given device or viewport. They are required, when using our grid-system. While containers can be nested, most layouts do not require a nested container.</p> | ||
<div className="lead"> | ||
Containers are essential layout elements ensuring content is aligned and properly padded across all devices and viewports. | ||
</div> | ||
|
||
We can distinguish between two different container types: | ||
<div className="alert alert-info"> | ||
Containers are required when using the <a href="/?path=/docs/7240f2ef-216a-490e-9bd8-c0cef19f7b31--docs">grid system</a>. | ||
</div> | ||
|
||
- <code>.container</code>, which defines a <code>max-width</code> on some breakpoints. | ||
- <code>.container-fluid</code>, which is <code>width: 100%</code> at all breakpoints. | ||
There is two types of containers: | ||
|
||
<ContainersTable /> | ||
## Container | ||
|
||
## Default container | ||
|
||
Our default `.container` class is a responsive, fixed-width container. | ||
The `.container` adapts its width based on the viewport size, but it will not exceed 1280px. | ||
This ensures content stays centered and does not stretch too wide on large screens. | ||
|
||
<Source code={`<div class="container"> | ||
<!-- Content here --> | ||
<!-- Content goes here --> | ||
</div>`} language="scss"/> | ||
|
||
## Fluid containers | ||
## Fluid Container | ||
|
||
Use `.container-fluid` for a full width container, spanning the entire width of the viewport on every breakpoint. | ||
The `.container-fluid` spans the entire width of the viewport, regardless of its size. | ||
Use this for layouts where the content should stretch edge-to-edge, even on large screens. | ||
|
||
<Source code={`<div class="container-fluid"> | ||
<!-- Content here --> | ||
<!-- Content goes here --> | ||
</div>`} language="scss"/> | ||
|
||
## CSS | ||
|
||
When using our source Sass files, you have the option of using Sass variables for customization (not recommended). | ||
|
||
### Sass variables | ||
|
||
<Source | ||
language="scss" | ||
dark | ||
code={Object.entries(SCSS_VARIABLES.variables) | ||
.map(([key, value]) => `$${key}: ${formatAsMap(value)};`) | ||
.join('\n')} | ||
></Source> |
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
14 changes: 0 additions & 14 deletions
14
packages/documentation/src/stories/foundation/layout/grid/grid-scss-mixins.sample.scss
This file was deleted.
Oops, something went wrong.
54 changes: 0 additions & 54 deletions
54
packages/documentation/src/stories/foundation/layout/grid/grid.blocks.tsx
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
Oops, something went wrong.