Skip to content

Commit e3f01b8

Browse files
refactor(dialog): styles added for components in takeover dialogs
1 parent 4517e92 commit e3f01b8

File tree

3 files changed

+66
-6
lines changed

3 files changed

+66
-6
lines changed

components/dialog/index.css

+8-2
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,13 @@ governing permissions and limitations under the License.
151151

152152
/* Without this, buttons will be stretched */
153153
align-items: flex-start;
154-
justify-content: space-between;
155154

156155
box-sizing: border-box;
157156

158157
outline: none; /* Hide focus outline around header */
159158

160159
/* additional header content should grow/shrink with the text, but only until it takes up half of the header */
161-
> .spectrum-Dialog-headerContent {
160+
> .spectrum-Dialog-headerContentWrapper {
162161
max-inline-size: fit-content;
163162
flex: 1 1 100%;
164163
font-size: var(--mod-standard-dialog-header-content-font-size, var(--spectrum-standard-dialog-header-content-font-size));
@@ -295,6 +294,13 @@ governing permissions and limitations under the License.
295294
gap: var(--mod-takeover-dialog-spacing-header-content-gap, var(--spectrum-takeover-dialog-spacing-header-content-gap));
296295
margin-inline-end: var(--mod-takeover-dialog-spacing-header-content-gap, var(--spectrum-takeover-dialog-spacing-header-content-gap));
297296
margin-block-end: var(--spectrum-takeover-dialog-spacing-title-to-content);
297+
298+
/* components in fullscreen/fullscreenTakeover dialogs are centered in the headerContentWrapper */
299+
> .spectrum-Dialog-headerContentWrapper {
300+
max-inline-size: unset;
301+
display: inline-flex;
302+
justify-content: center;
303+
}
298304
}
299305

300306
.spectrum-Dialog-heading {

components/dialog/stories/dialog.stories.js

+52
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Template as Table } from "@spectrum-css/table/stories/template.js";
2+
import { Template as Steplist } from "@spectrum-css/steplist/stories/template.js";
13
import { Template as Typography } from "@spectrum-css/typography/stories/template.js";
24
import { version } from "../package.json";
35
import { DialogFullscreen, DialogFullscreenTakeover, DialogGroup } from "./dialog.test.js";
@@ -269,10 +271,59 @@ WithScroll.parameters = {
269271

270272
/**
271273
* The fullscreen variant shows a large dialog background, only revealing a small portion of the page around the outside of the dialog, behind an overlay. The size of the dialog varies with the size of the screen, in both width and height.
274+
*
275+
* Implementations may swap out the extra header content and body content for other components, like the [steplist](/docs/components-steplist--docs) and [table](/docs/components-table--docs)seen in this example. Content in this area will be centered.
272276
*/
273277
export const Fullscreen = DialogFullscreen.bind({});
274278
Fullscreen.args = {
275279
...Default.args,
280+
header:[
281+
(passthroughs, context) => Steplist({
282+
...passthroughs,
283+
items: [
284+
{
285+
label: "Enter records",
286+
isComplete: true,
287+
},
288+
{
289+
label: "Confirmation",
290+
isComplete: true,
291+
},
292+
{
293+
label: "Summary",
294+
isSelected: true,
295+
},
296+
],
297+
}, context),
298+
],
299+
content: [
300+
(passthroughs, context) => Table({
301+
...passthroughs,
302+
showThumbnails: true,
303+
rowItems: [
304+
{
305+
cellContent: ["Table Row Alpha", "Test", "2"],
306+
},
307+
{
308+
cellContent: ["Table Row Bravo", "Test", "28"],
309+
},
310+
{
311+
cellContent: [
312+
"Table Row Charlie. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.",
313+
"Test",
314+
"23",
315+
],
316+
},
317+
{
318+
cellContent: ["Table Row Delta", "Test", "7"],
319+
},
320+
{
321+
cellContent: ["Summary Row", "", "60"],
322+
isSummaryRow: true,
323+
},
324+
],
325+
}, context),
326+
],
276327
layout: "fullscreen",
277328
hasFooter: false,
278329
};
@@ -287,6 +338,7 @@ Fullscreen.parameters = {
287338
// https://github.com/storybookjs/storybook/discussions/18542
288339
Fullscreen.argTypes = {
289340
hasFooter: { table: { disable: true, } },
341+
header: { table: { disable: true, } },
290342
};
291343

292344
/**

components/dialog/stories/template.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const Template = ({
1919
showModal = false,
2020
hasFooter = false,
2121
heading,
22-
header,
22+
header = [],
2323
footer,
2424
hasCheckbox = false,
2525
content = [],
@@ -63,9 +63,11 @@ export const Template = ({
6363
<h1 class="${rootClass}-heading">${heading}</h1>
6464
`)}
6565
${when(header, () => html`
66-
<span class="${rootClass}-headerContent">
67-
${renderContent(header)}
68-
</span>
66+
<div class="${rootClass}-headerContentWrapper">
67+
<div class="${rootClass}-headerContent">
68+
${renderContent(header)}
69+
</div>
70+
</div>
6971
`,
7072
)}
7173
</div>

0 commit comments

Comments
 (0)