Skip to content

Commit

Permalink
refactor(dialog): styles added for components in takeover dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
marissahuysentruyt committed Dec 10, 2024
1 parent 4517e92 commit e3f01b8
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 6 deletions.
10 changes: 8 additions & 2 deletions components/dialog/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,13 @@ governing permissions and limitations under the License.

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

box-sizing: border-box;

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

/* additional header content should grow/shrink with the text, but only until it takes up half of the header */
> .spectrum-Dialog-headerContent {
> .spectrum-Dialog-headerContentWrapper {
max-inline-size: fit-content;
flex: 1 1 100%;
font-size: var(--mod-standard-dialog-header-content-font-size, var(--spectrum-standard-dialog-header-content-font-size));
Expand Down Expand Up @@ -295,6 +294,13 @@ governing permissions and limitations under the License.
gap: var(--mod-takeover-dialog-spacing-header-content-gap, var(--spectrum-takeover-dialog-spacing-header-content-gap));
margin-inline-end: var(--mod-takeover-dialog-spacing-header-content-gap, var(--spectrum-takeover-dialog-spacing-header-content-gap));
margin-block-end: var(--spectrum-takeover-dialog-spacing-title-to-content);

/* components in fullscreen/fullscreenTakeover dialogs are centered in the headerContentWrapper */
> .spectrum-Dialog-headerContentWrapper {
max-inline-size: unset;
display: inline-flex;
justify-content: center;
}
}

.spectrum-Dialog-heading {
Expand Down
52 changes: 52 additions & 0 deletions components/dialog/stories/dialog.stories.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Template as Table } from "@spectrum-css/table/stories/template.js";
import { Template as Steplist } from "@spectrum-css/steplist/stories/template.js";
import { Template as Typography } from "@spectrum-css/typography/stories/template.js";
import { version } from "../package.json";
import { DialogFullscreen, DialogFullscreenTakeover, DialogGroup } from "./dialog.test.js";
Expand Down Expand Up @@ -269,10 +271,59 @@ WithScroll.parameters = {

/**
* 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.
*
* 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.
*/
export const Fullscreen = DialogFullscreen.bind({});
Fullscreen.args = {
...Default.args,
header:[
(passthroughs, context) => Steplist({
...passthroughs,
items: [
{
label: "Enter records",
isComplete: true,
},
{
label: "Confirmation",
isComplete: true,
},
{
label: "Summary",
isSelected: true,
},
],
}, context),
],
content: [
(passthroughs, context) => Table({
...passthroughs,
showThumbnails: true,
rowItems: [
{
cellContent: ["Table Row Alpha", "Test", "2"],
},
{
cellContent: ["Table Row Bravo", "Test", "28"],
},
{
cellContent: [
"Table Row Charlie. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.",
"Test",
"23",
],
},
{
cellContent: ["Table Row Delta", "Test", "7"],
},
{
cellContent: ["Summary Row", "", "60"],
isSummaryRow: true,
},
],
}, context),
],
layout: "fullscreen",
hasFooter: false,
};
Expand All @@ -287,6 +338,7 @@ Fullscreen.parameters = {
// https://github.com/storybookjs/storybook/discussions/18542
Fullscreen.argTypes = {
hasFooter: { table: { disable: true, } },
header: { table: { disable: true, } },
};

/**
Expand Down
10 changes: 6 additions & 4 deletions components/dialog/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Template = ({
showModal = false,
hasFooter = false,
heading,
header,
header = [],
footer,
hasCheckbox = false,
content = [],
Expand Down Expand Up @@ -63,9 +63,11 @@ export const Template = ({
<h1 class="${rootClass}-heading">${heading}</h1>
`)}
${when(header, () => html`
<span class="${rootClass}-headerContent">
${renderContent(header)}
</span>
<div class="${rootClass}-headerContentWrapper">
<div class="${rootClass}-headerContent">
${renderContent(header)}
</div>
</div>
`,
)}
</div>
Expand Down

0 comments on commit e3f01b8

Please sign in to comment.