Skip to content

Commit b796cb7

Browse files
feat(kit): Drawer support safe-area top/bottom (#11296)
Co-authored-by: taiga-family-bot <taiga-family-bot@users.noreply.github.com>
1 parent 7f92639 commit b796cb7

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

projects/demo/src/modules/components/drawer/examples/1/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Component, signal} from '@angular/core';
22
import {changeDetection} from '@demo/emulate/change-detection';
33
import {encapsulation} from '@demo/emulate/encapsulation';
44
import {TuiRepeatTimes} from '@taiga-ui/cdk';
5-
import {TuiButton, TuiLink, TuiPopup, TuiScrollbar, TuiTitle} from '@taiga-ui/core';
5+
import {TuiButton, TuiLink, TuiPopup, TuiTitle} from '@taiga-ui/core';
66
import {TuiBadge, TuiDrawer, TuiTabs} from '@taiga-ui/kit';
77
import {TuiHeader, TuiNavigation} from '@taiga-ui/layout';
88

@@ -17,7 +17,6 @@ import {TuiHeader, TuiNavigation} from '@taiga-ui/layout';
1717
TuiNavigation,
1818
TuiPopup,
1919
TuiRepeatTimes,
20-
TuiScrollbar,
2120
TuiTabs,
2221
TuiTitle,
2322
],

projects/kit/components/drawer/drawer.style.less

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
:host {
44
position: fixed;
5-
top: 3rem;
5+
top: ~'max(3rem, env(safe-area-inset-top))';
66
bottom: 0;
77
inline-size: 36.25rem;
88
max-inline-size: calc(100vw - 3rem);
@@ -16,21 +16,27 @@
1616
animation-name: tuiFade, tuiSlide;
1717
}
1818

19-
&._overlay::before {
20-
.transition(opacity);
21-
22-
content: '';
23-
position: fixed;
24-
top: -100vh;
25-
left: -100vw;
26-
right: -100vw;
27-
bottom: -100vh;
28-
background: var(--tui-service-backdrop);
29-
transition-timing-function: ease-out;
30-
31-
tui-root:has(tui-dialogs .t-overlay_visible) & {
32-
opacity: 0;
33-
transition-timing-function: ease-in;
19+
&._overlay {
20+
> .t-aside {
21+
padding-block-start: env(safe-area-inset-top);
22+
}
23+
24+
&::before {
25+
.transition(opacity);
26+
27+
content: '';
28+
position: fixed;
29+
top: -100vh;
30+
left: -100vw;
31+
right: -100vw;
32+
bottom: -100vh;
33+
background: var(--tui-service-backdrop);
34+
transition-timing-function: ease-out;
35+
36+
tui-root:has(tui-dialogs .t-overlay_visible) & {
37+
opacity: 0;
38+
transition-timing-function: ease-in;
39+
}
3440
}
3541
}
3642
}
@@ -43,6 +49,8 @@
4349
border-radius: inherit;
4450
overflow: hidden;
4551
background: inherit;
52+
box-sizing: border-box;
53+
padding-block-end: env(safe-area-inset-bottom);
4654
}
4755

4856
.t-scrollbar {

0 commit comments

Comments
 (0)