-
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.
chore(documentation, styles): shadow utilities
- Loading branch information
Showing
7 changed files
with
115 additions
and
0 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': patch | ||
'@swisspost/design-system-styles': patch | ||
--- | ||
|
||
Internalized bootstrap shadow utility into the design system. |
15 changes: 15 additions & 0 deletions
15
packages/documentation/src/stories/utilities/shadow/shadow.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,15 @@ | ||
import { Canvas, Controls, Meta, Source } from '@storybook/blocks'; | ||
import * as ShadowStories from './shadow.stories'; | ||
|
||
<Meta of={ShadowStories} /> | ||
|
||
# Shadow | ||
|
||
<div className="lead">The shadow property controls an element's box shadow.</div> | ||
|
||
Available values are the following: `.shadow`, `.shadow-sm`, `.shadow-lg` and `.shadow-none`. | ||
|
||
<Canvas sourceState="shown" of={ShadowStories.Default} /> | ||
<div className="hide-col-default"> | ||
<Controls of={ShadowStories.Default} /> | ||
</div> |
27 changes: 27 additions & 0 deletions
27
packages/documentation/src/stories/utilities/shadow/shadow.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,27 @@ | ||
import type { Args, StoryContext, StoryObj } from '@storybook/web-components'; | ||
import { html } from 'lit'; | ||
import { schemes } from '@/shared/snapshots/schemes'; | ||
import meta from './shadow.stories'; | ||
|
||
const { id, ...metaWithoutId } = meta; | ||
|
||
export default { | ||
...metaWithoutId, | ||
title: 'Snapshots', | ||
}; | ||
|
||
type Story = StoryObj; | ||
|
||
export const Shadow: Story = { | ||
render: (_args: Args, context: StoryContext) => { | ||
return schemes( | ||
() => html` | ||
<div class="d-flex gap-32 flex-column"> | ||
${(context.argTypes.shadow.options as string[]).map(shadow => | ||
meta.render?.({ ...meta.args, shadow }, context), | ||
)} | ||
</div> | ||
`, | ||
); | ||
}, | ||
}; |
48 changes: 48 additions & 0 deletions
48
packages/documentation/src/stories/utilities/shadow/shadow.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,48 @@ | ||
import type { Args, StoryObj, StoryFn, StoryContext } from '@storybook/web-components'; | ||
import { html } from 'lit'; | ||
import './shadow.styles.scss'; | ||
import { MetaExtended } from '@root/types'; | ||
|
||
export const ShadowLabels: { [key: string]: string } = { | ||
'shadow': 'Default shadow', | ||
'shadow-sm': 'Small shadow', | ||
'shadow-lg': 'Large shadow', | ||
'shadow-none': 'No shadow', | ||
}; | ||
|
||
const meta: MetaExtended = { | ||
id: '69f2b7e0-827d-4a7a-8580-5ff46dac276d', | ||
title: 'Utilities/Shadow', | ||
args: { | ||
shadow: 'shadow', | ||
}, | ||
argTypes: { | ||
shadow: { | ||
name: 'Shadow', | ||
description: 'Size of the shadow', | ||
control: { | ||
type: 'select', | ||
labels: ShadowLabels, | ||
}, | ||
options: ['shadow', 'shadow-sm', 'shadow-lg', 'shadow-none'], | ||
table: { | ||
category: 'General', | ||
}, | ||
}, | ||
}, | ||
render: (args: Args) => { | ||
return html` <div class="${args.shadow}">${ShadowLabels[args.shadow]}</div> `; | ||
}, | ||
decorators: [ | ||
(story: StoryFn, context: StoryContext) => { | ||
const storyTemplate = html`<div class="shadow-example">${story(context.args, context)}</div>`; | ||
return storyTemplate; | ||
}, | ||
], | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj; | ||
|
||
export const Default: Story = {}; |
6 changes: 6 additions & 0 deletions
6
packages/documentation/src/stories/utilities/shadow/shadow.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,6 @@ | ||
@use '@swisspost/design-system-styles/core' as post; | ||
|
||
.shadow-example [class|='shadow'] { | ||
border-radius: post.$border-radius; | ||
padding: 1rem; | ||
} |
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