Skip to content

Commit eff80b9

Browse files
refactor(dialog): footer, dismissible and layout fixes
- uses the fullscreen and fullscreenTakeover layouts to determine whether the buttonGroup should show at the top of the dialog - set the footer or noFooter class, use a isDismissible check to determine if the buttonGroup should be rendered (this should take care of instances for footer or no footer content regardless of the isDismissible value)
1 parent 0bfa1a8 commit eff80b9

File tree

1 file changed

+40
-32
lines changed

1 file changed

+40
-32
lines changed

components/dialog/stories/template.js

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -82,51 +82,59 @@ export const Template = ({
8282
`
8383
])}
8484
</div>
85-
${when(layout !== "default", () => [
86-
html`
87-
<div class="${rootClass}-buttonGroup">
88-
<div class="${rootClass}-buttonGroup--noFooter">
85+
86+
${when(isDismissable, () =>
87+
CloseButton({
88+
customClasses: [`${rootClass}-closeButton`],
89+
...globals,
90+
onclick: () => {
91+
updateArgs({ isOpen: !isOpen });
92+
},
93+
}),
94+
)}
95+
96+
${when(layout === "fullscreen" || layout === "fullscreenTakeover", () => html`
97+
<div class="${rootClass}-buttonGroup">
98+
${ButtonGroup({
99+
items: buttons,
100+
onclick: () => {
101+
updateArgs({ isOpen: !isOpen });
102+
},
103+
})}
104+
</div>`
105+
)}
106+
107+
<section class="${rootClass}-content">${content.map((c) => (typeof c === "function" ? c({}) : c))}</section>
108+
109+
${when(footer, () => html`
110+
<div class="${rootClass}-footer">
111+
${Typography({
112+
semantics: "body",
113+
size: "m",
114+
content: footer,
115+
})}
116+
${when(!isDismissable, () => html`
117+
<div class="${rootClass}-buttonGroup">
89118
${ButtonGroup({
90119
items: buttons,
91120
onclick: () => {
92121
updateArgs({ isOpen: !isOpen });
93122
},
94123
})}
95-
</div>
96-
</div>
97-
`
98-
])}
99-
${when(isDismissable, () =>
100-
CloseButton({
101-
customClasses: [`${rootClass}-closeButton`],
102-
...globals,
103-
onclick: () => {
104-
updateArgs({ isOpen: !isOpen });
105-
},
106-
}),
124+
</div>`
125+
)}
126+
</div>`,
107127
() => html`
108-
<div class="${rootClass}-buttonGroup">
109-
<div class="${rootClass}-buttonGroup--noFooter">
128+
${when(!isDismissable, () => html`
129+
<div class="${rootClass}-buttonGroup ${rootClass}-buttonGroup--noFooter">
110130
${ButtonGroup({
111131
items: buttons,
112132
onclick: () => {
113133
updateArgs({ isOpen: !isOpen });
114134
},
115135
})}
116-
</div>
117-
</div>
118-
`
119-
)}
120-
<section class="${rootClass}-content">${content.map((c) => (typeof c === "function" ? c({}) : c))}</section>
121-
${when(footer, () =>
122-
html`
123-
<div class="${rootClass}-footer">
124-
${Typography({
125-
semantics: "body",
126-
size: "m",
127-
content: footer,
128-
})}
129-
</div>
136+
</div>`
137+
)}
130138
`
131139
)}
132140
</div>

0 commit comments

Comments
 (0)