Skip to content

Commit 6bd360f

Browse files
committed
feat(backgroundlayers): add to storybook
1 parent 6b0aea8 commit 6bd360f

File tree

2 files changed

+61
-20
lines changed

2 files changed

+61
-20
lines changed
Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
// Import the component markup template
21
import { Template } from "./template";
2+
import { html } from 'lit';
33

4-
// More on default export: https://storybook.js.org/docs/web-components/writing-stories/introduction#default-export
54
export default {
6-
title: "Components/background layers",
7-
description: "The background layers component is...",
5+
title: "Elements/Background layers",
6+
description: "The background layers is a series of classes used to style background layers.",
87
component: "BackgroundLayers",
98
argTypes: {
10-
size: {
11-
name: "Size",
9+
context: {
10+
name: "Context",
1211
type: { name: "string", required: true },
13-
defaultValue: "m",
12+
defaultValue: "Browsing",
1413
table: {
1514
type: { summary: "string" },
1615
category: "Component",
17-
defaultValue: { summary: "m" }
16+
defaultValue: { summary: "browsing" }
1817
},
19-
options: ["s", "m", "l", "xl"],
18+
options: ["browsing", "editing"],
2019
control: "select"
2120
},
2221
},
23-
// More on args: https://storybook.js.org/docs/web-components/writing-stories/args
2422
args: {
2523
rootClass: "spectrum-BackgroundLayers",
26-
size: "m",
2724
},
2825
parameters: {
2926
actions: {
@@ -35,5 +32,51 @@ export default {
3532
}
3633
};
3734

38-
export const Default = Template.bind({});
39-
Default.args = {};
35+
const EditingContext = ({
36+
}) => {
37+
return html`
38+
<div style="display: flex; justify-content: flex-start; position: relative;">
39+
${Template({
40+
style: "z-index: 4;",
41+
layer: 'elevated',
42+
})}
43+
${Template({
44+
style: "z-index: 3; inset-inline-start: 15px; inset-block-start: 15px;",
45+
layer: 'layer2',
46+
})}
47+
${Template({
48+
style: "z-index: 2; inset-inline-start: 25px; inset-block-start: 25px;",
49+
layer: 'layer1',
50+
})}
51+
${Template({
52+
style: "z-index: 1; inset-inline-start: 35px; inset-block-start: 35px;",
53+
layer: "pasteboard",
54+
})}
55+
</div>
56+
`;
57+
};
58+
59+
const BrowsingContext = ({
60+
}) => {
61+
return html`
62+
<div style="display: flex; justify-content: flex-start; position: relative;">
63+
${Template({
64+
style: "z-index: 3;",
65+
layer: 'elevated',
66+
})}
67+
${Template({
68+
style: "z-index: 2; inset-inline-start: 15px; inset-block-start: 15px;",
69+
layer: 'layer1',
70+
})}
71+
${Template({
72+
style: "z-index: 1; inset-inline-start: 25px; inset-block-start: 25px;",
73+
layer: "base",
74+
})}
75+
</div>
76+
`;
77+
};
78+
export const Editing = EditingContext.bind({});
79+
Editing.args = {};
80+
81+
export const Browsing = BrowsingContext.bind({});
82+
Browsing.args = {};
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
import { html } from 'lit';
22
import { classMap } from 'lit/directives/class-map.js';
3-
import { ifDefined } from 'lit/directives/if-defined.js';
43

54
import "../index.css";
65

7-
// More on component templates: https://storybook.js.org/docs/web-components/writing-stories/introduction#using-args
86
export const Template = ({
97
rootClass = "spectrum-BackgroundLayers",
10-
size,
8+
style,
9+
layer,
1110
id,
1211
customClasses = [],
13-
...globals
1412
}) => {
1513
return html`
1614
<div class=${classMap({
1715
[rootClass]: true,
18-
[`${rootClass}--size${size.toUpperCase()}`]: true,
16+
[`${rootClass}--${layer}`]: true,
1917
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
20-
})} id=${ifDefined(id)}>
21-
<!-- Component mark-up goes here -->
18+
})}
19+
style="${style} inline-size: 100px; block-size: 100px; border-radius: 10px; position: absolute;">
2220
</div>
2321
`;
2422
}

0 commit comments

Comments
 (0)