Skip to content

Commit 56ea4ab

Browse files
langermankactions-userjonrohan
authored
Overlay updates for Alpha::Dialog (#2225)
* add size * Stylelint auto-fixes * update animations * Create swift-icons-stare.md * format * Stylelint auto-fixes * Update swift-icons-stare.md * i am so confused with git rn * please work * lint * Update src/overlay/overlay.scss Co-authored-by: Jon Rohan <[email protected]> Co-authored-by: Actions Auto Build <[email protected]> Co-authored-by: Jon Rohan <[email protected]>
1 parent 1a8e7db commit 56ea4ab

File tree

2 files changed

+99
-1
lines changed

2 files changed

+99
-1
lines changed

.changeset/swift-icons-stare.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@primer/css": patch
3+
---
4+
5+
Overlay updates for Alpha::Dialog
6+
- Size improvements
7+
- Support buttom and side sheets
8+
- Preliminary animations for sheets

src/overlay/overlay.scss

+91-1
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,67 @@ $primer-borderRadius-large: 0.75rem;
1515

1616
.Overlay {
1717
display: flex;
18+
width: min(var(--overlay-width), 100vw - 2rem);
1819
min-width: 192px;
20+
max-height: min(calc(100vh - 2rem), var(--overlay-height));
1921
flex-direction: column;
2022
background-color: var(--color-canvas-overlay);
2123
border-radius: $primer-borderRadius-large;
2224
box-shadow: var(--color-overlay-shadow);
2325
opacity: 1;
2426

27+
&.Overlay--size-auto {
28+
min-width: 192px;
29+
max-width: calc(100vw - 2rem);
30+
max-height: calc(100vh - 2rem);
31+
}
32+
33+
&.Overlay--size-full {
34+
width: 100vw;
35+
height: 100vh;
36+
}
37+
38+
&.Overlay--size-xsmall {
39+
--overlay-width: 192px;
40+
41+
max-height: calc(100vh - 2rem);
42+
}
43+
44+
&.Overlay--size-small {
45+
--overlay-height: 256px;
46+
--overlay-width: 320px;
47+
}
48+
49+
&.Overlay--size-small-portrait {
50+
--overlay-height: 432px;
51+
--overlay-width: 320px;
52+
}
53+
54+
&.Overlay--size-medium {
55+
--overlay-height: 320px;
56+
--overlay-width: 480px;
57+
}
58+
59+
&.Overlay--size-medium-portrait {
60+
--overlay-height: 600px;
61+
--overlay-width: 480px;
62+
}
63+
64+
&.Overlay--size-large {
65+
--overlay-height: 432px;
66+
--overlay-width: 640px;
67+
}
68+
69+
&.Overlay--size-xlarge {
70+
--overlay-height: 600px;
71+
--overlay-width: 960px;
72+
}
73+
2574
&.Overlay--height-auto {
2675
height: auto;
2776
}
2877

78+
// start deprecate in favor of Alpha::Dialog
2979
&.Overlay--height-xsmall {
3080
height: min(192px, 100vh - 2rem);
3181
}
@@ -73,6 +123,8 @@ $primer-borderRadius-large: 0.75rem;
73123
width: min(960px, 100vw - 2rem);
74124
}
75125

126+
// end deprecate
127+
76128
&.Overlay--motion-scaleFade {
77129
@media screen and (prefers-reduced-motion: no-preference) {
78130
animation: 200ms cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running Overlay--motion-scaleFade;
@@ -172,6 +224,7 @@ $primer-borderRadius-large: 0.75rem;
172224
padding-top: 0;
173225
overflow-y: auto;
174226
scrollbar-width: thin;
227+
scrollbar-gutter: stable;
175228
font-size: $body-font-size;
176229
flex-grow: 1;
177230

@@ -293,9 +346,15 @@ $primer-borderRadius-large: 0.75rem;
293346
justify-content: left;
294347

295348
.Overlay#{$responsiveVariant} {
349+
height: 100vh;
350+
max-height: unset;
296351
border-radius: $primer-borderRadius-large;
297352
border-top-left-radius: 0;
298353
border-bottom-left-radius: 0;
354+
355+
@media screen and (prefers-reduced-motion: no-preference) {
356+
animation: 160ms cubic-bezier(0.32, 0, 0.67, 0) 0s 1 normal none running Overlay--motion-slideInRight;
357+
}
299358
}
300359
}
301360

@@ -304,9 +363,15 @@ $primer-borderRadius-large: 0.75rem;
304363
justify-content: right;
305364

306365
.Overlay#{$responsiveVariant} {
366+
height: 100vh;
367+
max-height: unset;
307368
border-radius: $primer-borderRadius-large;
308369
border-top-right-radius: 0;
309370
border-bottom-right-radius: 0;
371+
372+
@media screen and (prefers-reduced-motion: no-preference) {
373+
animation: 160ms cubic-bezier(0.32, 0, 0.67, 0) 0s 1 normal none running Overlay--motion-slideInLeft;
374+
}
310375
}
311376
}
312377

@@ -315,9 +380,16 @@ $primer-borderRadius-large: 0.75rem;
315380
justify-content: center;
316381

317382
.Overlay#{$responsiveVariant} {
383+
width: 100vw;
384+
height: auto;
385+
max-height: calc(100vh - 2rem);
318386
border-radius: $primer-borderRadius-large;
319387
border-bottom-right-radius: 0;
320388
border-bottom-left-radius: 0;
389+
390+
@media screen and (prefers-reduced-motion: no-preference) {
391+
animation: 160ms cubic-bezier(0.32, 0, 0.67, 0) 0s 1 normal none running Overlay--motion-slideUp;
392+
}
321393
}
322394
}
323395

@@ -342,7 +414,7 @@ $primer-borderRadius-large: 0.75rem;
342414
max-width: 100vw;
343415
height: 100%;
344416
max-height: 100vh;
345-
border-radius: unset;
417+
border-radius: unset !important;
346418
flex-grow: 1;
347419
}
348420
}
@@ -383,3 +455,21 @@ $primer-borderRadius-large: 0.75rem;
383455
@include Overlay-backdrop--full;
384456
}
385457
}
458+
459+
@keyframes Overlay--motion-slideUp {
460+
from {
461+
transform: translateY(100%);
462+
}
463+
}
464+
465+
@keyframes Overlay--motion-slideInRight {
466+
from {
467+
transform: translateX(-100%);
468+
}
469+
}
470+
471+
@keyframes Overlay--motion-slideInLeft {
472+
from {
473+
transform: translateX(100%);
474+
}
475+
}

0 commit comments

Comments
 (0)