Skip to content

Commit ce25a3e

Browse files
committed
docs(alertbanner): adjust storybook template spacing and decorator
Improves spacing in Storybook template, especially the Chromatic only template. Decorator and wrapper styles are modeled after those used in Action button, so they look more similar. Previously the layout was a little cramped and the "detail" elements were missing their margins because they were display inline.
1 parent 8657dfb commit ce25a3e

File tree

1 file changed

+85
-61
lines changed

1 file changed

+85
-61
lines changed

components/alertbanner/stories/alertbanner.stories.js

Lines changed: 85 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -69,70 +69,94 @@ export default {
6969
type: "migrated",
7070
},
7171
},
72+
decorators: [
73+
(Story, context) => html`
74+
<style>
75+
.spectrum-Detail { display: inline-block; }
76+
.spectrum-Typography > div {
77+
border: 1px solid var(--spectrum-gray-200);
78+
border-radius: 4px;
79+
padding: 1em;
80+
}
81+
</style>
82+
<div
83+
style=${styleMap({
84+
display: "flex",
85+
flexDirection: "column",
86+
alignItems: "flex-start",
87+
gap: "1.0rem",
88+
"--mod-detail-margin-end": ".3rem",
89+
})}
90+
>
91+
${Story(context)}
92+
</div>
93+
`,
94+
],
7295
};
7396

7497
const AlertBannerGroup = (args) => {
75-
return html`
76-
<div style="display: flex; flex-direction: column; gap: 1rem">
77-
${!window.isChromatic() ? Template(args) : html`
78-
<div class="spectrum-Typography">
79-
${Typography({
80-
semantics: "detail",
81-
size: "l",
82-
content: ["All variants with button, including wrapping"],
83-
})}
84-
<div
85-
style=${styleMap({
86-
display: "flex",
87-
flexDirection: "column",
88-
gap: ".3rem",
89-
})}
90-
>
91-
${Template(args)}
92-
${Template({
93-
...args,
94-
variant: "info",
95-
text: "Your trial will expire in 3 days. Once it expires your files will be saved and ready for you to open again once you have purchased the software.",
96-
})}
97-
${Template({
98-
...args,
99-
variant: "negative",
100-
text: "Connection interupted. Check your network to continue.",
101-
})}
102-
</div>
103-
</div>
104-
<div class="spectrum-Typography">
105-
${Typography({
106-
semantics: "detail",
107-
size: "l",
108-
content: ["All variants without button"],
109-
})}
110-
<div
111-
style=${styleMap({
112-
display: "flex",
113-
flexDirection: "column",
114-
gap: ".3rem",
115-
})}
116-
>
117-
${Template({
118-
...args,
119-
actionButtonText: "",
120-
})}
121-
${Template({
122-
...args,
123-
variant: "info",
124-
text: "Your trial will expire in 3 days. Once it expires your files will be saved and ready for you to open again once you have purchased the software.",
125-
actionButtonText: "",
126-
})}
127-
${Template({
128-
...args,
129-
variant: "negative",
130-
text: "Connection interupted. Check your network to continue.",
131-
actionButtonText: "",
132-
})}
133-
</div>
134-
</div>
135-
`}
98+
return !window.isChromatic() ? Template(args) : html`
99+
<div class="spectrum-Typography">
100+
${Typography({
101+
semantics: "detail",
102+
size: "l",
103+
content: ["All variants with button, including wrapping"],
104+
})}
105+
<div
106+
style=${styleMap({
107+
display: "flex",
108+
flexDirection: "column",
109+
gap: "0.75rem",
110+
})}
111+
>
112+
${Template(args)}
113+
${Template({
114+
...args,
115+
variant: "info",
116+
text: "Your trial will expire in 3 days. Once it expires your files will be saved and ready for you to open again once you have purchased the software.",
117+
})}
118+
${Template({
119+
...args,
120+
variant: "negative",
121+
text: "Connection interupted. Check your network to continue.",
122+
})}
123+
${Template({
124+
...args,
125+
isOpen: false,
126+
text: "This alert banner should never be displayed in VRTs. This is to test that it is not displayed when there is no is-open class applied.",
127+
})}
128+
</div>
129+
</div>
130+
<div class="spectrum-Typography">
131+
${Typography({
132+
semantics: "detail",
133+
size: "l",
134+
content: ["All variants without button"],
135+
})}
136+
<div
137+
style=${styleMap({
138+
display: "flex",
139+
flexDirection: "column",
140+
gap: "0.75rem",
141+
})}
142+
>
143+
${Template({
144+
...args,
145+
actionButtonText: "",
146+
})}
147+
${Template({
148+
...args,
149+
variant: "info",
150+
text: "Your trial will expire in 3 days. Once it expires your files will be saved and ready for you to open again once you have purchased the software.",
151+
actionButtonText: "",
152+
})}
153+
${Template({
154+
...args,
155+
variant: "negative",
156+
text: "Connection interupted. Check your network to continue.",
157+
actionButtonText: "",
158+
})}
159+
</div>
136160
</div>
137161
`;
138162
};

0 commit comments

Comments
 (0)