Skip to content

Commit 295b6ac

Browse files
docs(dropshadow): add storybook entry
1 parent 1cbcb1c commit 295b6ac

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Meta, Title, Story } from '@storybook/blocks';
2+
import * as DropShadowStories from './drop-shadow.stories.js';
3+
4+
5+
<Meta of={DropShadowStories} />
6+
7+
<Title />
8+
9+
## Emphasized Default
10+
<Story of={DropShadowStories.DropShadowEmphasizedDefault} />
11+
12+
## Emphasized Hover
13+
<Story of={DropShadowStories.DropShadowEmphasizedHover} />
14+
15+
## Elevated
16+
<Story of={DropShadowStories.DropShadowElevated} />
17+
18+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { html } from "lit";
2+
import { classMap } from "lit/directives/class-map.js";
3+
import "./index.css";
4+
5+
export default {
6+
title: "Foundations/Drop shadow",
7+
description: "Drop shadows draw attention and give the appearance of depth. By default, this style is used to show elevation, when content appears on top of other content.",
8+
component: "Drop shadow",
9+
tags: ['foundation'],
10+
}
11+
12+
const DropShadowSwatch = ({rootClass = "spectrum-Foundations-Example-DropShadow-swatch", variant}) => {
13+
return html`
14+
<div class=${classMap({
15+
[rootClass]: true,
16+
[`${rootClass}--${variant}`]: typeof variant !== undefined,
17+
})}></div>
18+
`;}
19+
20+
const DropShadowBackground = ({rootClass = "spectrum-Foundations-Example-swatch-container", color, ...args}) => {
21+
22+
return html`
23+
<div class=${classMap({
24+
[rootClass]: true,
25+
"spectrum--light": color === "light",
26+
"spectrum--dark": color === "dark",
27+
})}>
28+
${DropShadowSwatch(args)}
29+
</div>
30+
`;
31+
}
32+
33+
const DropShadowVariant = ({...args}) => {
34+
return html`
35+
<div class="spectrum-Foundations-Example-variant-container">
36+
${DropShadowBackground({...args, color: "light"})}
37+
${DropShadowBackground({...args, color: "dark"})}
38+
</div>
39+
`;}
40+
41+
42+
export const DropShadowEmphasizedDefault = DropShadowVariant.bind({});
43+
DropShadowEmphasizedDefault.args = {
44+
variant: "emphasized-default",
45+
};
46+
47+
export const DropShadowEmphasizedHover = DropShadowVariant.bind({});
48+
DropShadowEmphasizedHover.args = {
49+
variant: "emphasized-hover",
50+
};
51+
52+
export const DropShadowElevated = DropShadowVariant.bind({});
53+
DropShadowElevated.args = {
54+
variant: "elevated",
55+
};
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*!
2+
Copyright 2024 Adobe. All rights reserved.
3+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License. You may obtain a copy
5+
of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
7+
Unless required by applicable law or agreed to in writing, software distributed under
8+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
OF ANY KIND, either express or implied. See the License for the specific language
10+
governing permissions and limitations under the License.
11+
*/
12+
13+
@import "../../../components/commons/dropshadow.css";
14+
15+
.spectrum-Foundations-Example-DropShadow-swatch {
16+
block-size: 150px;
17+
inline-size: 150px;
18+
background-color: var(--spectrum-gray-25);
19+
border-radius: var(--spectrum-corner-radius-large-default);
20+
border: transparent;
21+
}
22+
23+
.spectrum--dark .spectrum-Foundations-Example-DropShadow-swatch {
24+
background-color: var(--spectrum-gray-75); /* matches dark mode design spec rgb(34, 34, 34) */
25+
}
26+
27+
.spectrum-Foundations-Example-DropShadow-swatch--emphasized-default {
28+
@extend %spectrum-DropShadow-emphasized-default;
29+
}
30+
31+
.spectrum--dark .spectrum-Foundations-Example-DropShadow-swatch--emphasized-default {
32+
/* override with correct color for dark mode in this example page only */
33+
--mod-drop-shadow-emphasized-default-color: var(--spectrum-drop-shadow-color-100);
34+
}
35+
36+
.spectrum-Foundations-Example-DropShadow-swatch--emphasized-hover {
37+
@extend %spectrum-DropShadow-emphasized-hover;
38+
}
39+
40+
.spectrum--dark .spectrum-Foundations-Example-DropShadow-swatch--emphasized-hover {
41+
/* override with correct color for dark mode in this example page only */
42+
--mod-drop-shadow-emphasized-hover-color: var(--spectrum-drop-shadow-color-200);
43+
}
44+
45+
.spectrum-Foundations-Example-DropShadow-swatch--elevated {
46+
@extend %spectrum-DropShadow-elevated;
47+
}
48+
49+
.spectrum--dark .spectrum-Foundations-Example-DropShadow-swatch--elevated {
50+
/* override with correct color for dark mode in this example page only */
51+
--mod-drop-shadow-elevated-color: var(--spectrum-drop-shadow-color-200);
52+
}
53+
54+
.spectrum-Foundations-Example-swatch-container {
55+
background-color: var(--spectrum-gray-50);
56+
block-size: 200px;
57+
inline-size: 300px;
58+
display: flex;
59+
align-items: center;
60+
justify-content: center;
61+
}
62+
63+
.spectrum-Foundations-Example-variant-container {
64+
display: flex;
65+
flex-direction: row;
66+
}

0 commit comments

Comments
 (0)