Skip to content

Commit b7346b2

Browse files
Make Dialog footer scrollable on very short viewports (#5629)
Co-authored-by: TylerJDev <[email protected]> Co-authored-by: hectahertz <[email protected]>
1 parent 926f8f8 commit b7346b2

21 files changed

+26
-4
lines changed

.changeset/little-papayas-knock.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Make Dialog footer scrollable on very short viewports

.changeset/rich-berries-argue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Update the Dialog stress test story to go fullscreen on narrow screens
Loading
Loading

packages/react/src/Dialog/Dialog.features.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const StressTest = ({width, height, subtitle}: DialogStoryProps) => {
123123
const onDialogClose = useCallback(() => setIsOpen(false), [])
124124
const onSecondDialogClose = useCallback(() => setSecondOpen(false), [])
125125
const openSecondDialog = useCallback(() => setSecondOpen(true), [])
126-
const manyButtons = new Array(3).fill(undefined).map((_, i) => ({content: `Button ${i}`}))
126+
const manyButtons = new Array(7).fill(undefined).map((_, i) => ({content: `Button ${i}`}))
127127
return (
128128
<>
129129
<Button ref={buttonRef} onClick={() => setIsOpen(!isOpen)}>

packages/react/src/Dialog/Dialog.module.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,18 @@
243243
.Footer {
244244
z-index: 1;
245245
display: flex;
246+
flex-flow: wrap;
247+
justify-content: flex-end;
246248
padding: var(--base-size-16);
247249
/* stylelint-disable-next-line primer/box-shadow */
248250
box-shadow: 0 -1px 0 var(--borderColor-default);
249-
flex-flow: wrap;
250-
justify-content: flex-end;
251251
gap: var(--base-size-8);
252252
flex-shrink: 0;
253+
254+
@media (max-height: 325px) {
255+
flex-wrap: nowrap;
256+
overflow-x: scroll;
257+
flex-direction: row;
258+
justify-content: unset;
259+
}
253260
}

packages/react/src/Dialog/Dialog.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,12 @@ const StyledFooter = toggleStyledComponent(
631631
gap: ${get('space.2')};
632632
z-index: 1;
633633
flex-shrink: 0;
634-
634+
@media (max-height: 325px) {
635+
flex-wrap: nowrap;
636+
overflow-x: scroll;
637+
flex-direction: row;
638+
justify-content: unset;
639+
}
635640
${sx};
636641
`,
637642
)

0 commit comments

Comments
 (0)