-
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.
Merge branch 'main' into 3653-utilities-shadows
- Loading branch information
Showing
19 changed files
with
339 additions
and
14 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,6 @@ | ||
--- | ||
'@swisspost/design-system-documentation': minor | ||
'@swisspost/design-system-styles': minor | ||
--- | ||
|
||
Implemented gutter utility classes. |
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-components': patch | ||
--- | ||
|
||
Reduced the length of random IDs generated in the components; they are now generated using the [nanoid library](https://github.com/ai/nanoid) instead of the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API). |
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-components': patch | ||
--- | ||
|
||
Updated header overflow in tablet and mobile for long application titles. |
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
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
7 changes: 7 additions & 0 deletions
7
packages/documentation/cypress/snapshots/utilities/gutters.snapshot.ts
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,7 @@ | ||
describe('Gutters', () => { | ||
it('Gutters', () => { | ||
cy.visit('/iframe.html?id=snapshots--gutters'); | ||
cy.get('.gutters-example', { timeout: 30000 }).should('be.visible'); | ||
cy.percySnapshot('Gutters', { widths: [320, 780, 1024, 1440] }); | ||
}); | ||
}); |
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
58 changes: 58 additions & 0 deletions
58
packages/documentation/src/stories/utilities/gutters/gutters.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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Canvas, Controls, Meta } from '@storybook/blocks'; | ||
import * as GutterStories from './gutters.stories'; | ||
|
||
export const firstBreakpoint = Object.values(GutterStories.SCSS_VARIABLES.firstBreakpoint)[0]; | ||
export const breakpoints = Object.values(GutterStories.SCSS_VARIABLES.breakpoints).map( | ||
(breakpoint, i, arr) => [breakpoint, i !== arr.length - 1], | ||
); | ||
|
||
<Meta of={GutterStories} /> | ||
|
||
# Gutters | ||
|
||
Gutters are the spaces between column content in grid elements (e.g., `.row`, `.col`, `.col-*`). They are implemented by applying an inline-padding to each column, along with matching negative margins to offset the padding at the row's edges. | ||
|
||
## Horizontal gutters | ||
|
||
The `.gx-{size}` classes can be used to set the horizontal gutters within the columns (`.col`) of a `.row`. | ||
|
||
### Example | ||
|
||
<Canvas sourceState="shown" of={GutterStories.HorizontalGutters} /> | ||
<div className="hide-col-default"> | ||
<Controls of={GutterStories.HorizontalGutters} /> | ||
</div> | ||
|
||
## Vertical gutters | ||
|
||
The `.gy-{size}` classes can be used to set the vertical gutter width when a `.row` wraps to new lines. | ||
|
||
### Example | ||
|
||
<Canvas sourceState="shown" of={GutterStories.VerticalGutters} /> | ||
<div className="hide-col-default"> | ||
<Controls of={GutterStories.VerticalGutters} /> | ||
</div> | ||
|
||
## Horizontal and vertical gutters | ||
|
||
The `.g-{size}` classes can be used to set both the horizontal and vertical gutter widths. | ||
|
||
### Example | ||
|
||
<Canvas sourceState="shown" of={GutterStories.GeneralGutters} /> | ||
<div className="hide-col-default"> | ||
<Controls of={GutterStories.GeneralGutters} /> | ||
</div> | ||
|
||
## No gutters | ||
|
||
Gutters can be eliminated by applying the classes `.g-0`, `.gx-0`, or `.gy-0`, which remove all gutters, horizontal gutters, or vertical gutters, respectively. | ||
|
||
## Relative to breakpoints | ||
|
||
Breakpoint-specific classes allow precise control of horizontal, vertical, and general gutters at various screen sizes. | ||
|
||
- `.gx-{breakpoint}-{size}` (e.g. `gx-lg-24`) | ||
- `.gy-{breakpoint}-{size}` (e.g. `gy-sm-32`) | ||
- `.g-{breakpoint}-{size}` (e.g. `g-md-12`) |
18 changes: 18 additions & 0 deletions
18
packages/documentation/src/stories/utilities/gutters/gutters.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,18 @@ | ||
@use 'sass:list'; | ||
@use 'sass:map'; | ||
@use '@swisspost/design-system-styles/core' as post; | ||
@use '@swisspost/design-system-styles/tokens/utilities' as tokens; | ||
|
||
:export { | ||
@each $key, $value in tokens.$post-spacing { | ||
spacing_#{$key}: #{$value}; | ||
} | ||
@each $breakpoint in post.$grid-breakpoints-list { | ||
@if (map.get(post.$grid-breakpoints, $breakpoint) == 0) { | ||
firstBreakpoint_#{$breakpoint}: $breakpoint; | ||
} | ||
@if (map.get(post.$grid-breakpoints, $breakpoint) != 0) { | ||
breakpoints_#{$breakpoint}: $breakpoint; | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
packages/documentation/src/stories/utilities/gutters/gutters.snapshot.stories.ts
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,44 @@ | ||
import type { Args, StoryObj } from '@storybook/web-components'; | ||
import { html } from 'lit'; | ||
import { COLOR_SCHEMES, schemes } from '@/shared/snapshots/schemes'; | ||
import meta from './gutters.stories'; | ||
import './gutters.styles.scss'; | ||
import { bombArgs } from '@/utils'; | ||
|
||
const { id, ...metaWithoutId } = meta; | ||
|
||
export default { | ||
...metaWithoutId, | ||
title: 'Snapshots', | ||
}; | ||
|
||
const sizes = ['0', '1', '2', '4', '8', '12', '24', '32', '48']; | ||
const gutterType = ['g', 'gx', 'gy']; | ||
|
||
export const Gutters: StoryObj = { | ||
render: () => { | ||
return schemes( | ||
() => { | ||
return html` | ||
${bombArgs({ | ||
gutterType: gutterType, | ||
sizes: sizes, | ||
}).map( | ||
(args: Args) => | ||
html` | ||
<div class="container my-24 mx-0"> | ||
<div class="row ${args.gutterType}-${args.sizes}"> | ||
<div class="col-6">${args.gutterType}-${args.sizes}</div> | ||
<div class="col-6">${args.gutterType}-${args.sizes}</div> | ||
<div class="col-6">${args.gutterType}-${args.sizes}</div> | ||
<div class="col-6">${args.gutterType}-${args.sizes}</div> | ||
</div> | ||
</div> | ||
`, | ||
)} | ||
`; | ||
}, | ||
{ filter: scheme => scheme === COLOR_SCHEMES.light }, | ||
); | ||
}, | ||
}; |
Oops, something went wrong.