Skip to content

Commit 4e6ab61

Browse files
committed
Refactor drawer layout: move close button to slot and set full width/height
Refs: #7487
1 parent a52c2e1 commit 4e6ab61

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

packages/components/src/components/drawer/style.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
#{$root}__content {
2727
height: 100%;
28-
max-width: rem(400);
29-
box-sizing: border-box;
3028
}
3129
}
3230

@@ -38,8 +36,6 @@
3836

3937
#{$root}__content {
4038
height: 100%;
41-
max-width: rem(400);
42-
box-sizing: border-box;
4339
}
4440
}
4541

@@ -51,8 +47,6 @@
5147

5248
#{$root}__content {
5349
width: 100%;
54-
max-height: rem(400);
55-
box-sizing: border-box;
5650
}
5751
}
5852

@@ -64,8 +58,6 @@
6458

6559
#{$root}__content {
6660
width: 100%;
67-
max-height: rem(400);
68-
box-sizing: border-box;
6961
}
7062
}
7163
}

packages/samples/react/src/components/drawer/basic.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export const DrawerBasic: FC = () => {
3030
<DrawerRadioAlign value={align} onChange={(_, value) => setAlign(value as AlignPropType)} />
3131
<div className="flex flex-wrap gap-4">
3232
<KolDrawer ref={drawerElement} _label="I am a drawer" _align={align} _on={{ onClose: () => console.log('Drawer onClose triggered!') }}>
33-
<p>
34-
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
35-
voluptua.
36-
</p>
37-
<KolButton _label="Close drawer" _on={{ onClick: () => drawerElement.current?.close() }} />
33+
<div className={align === 'left' || align == 'right' ? 'drawer-content-vertical' : ''}>
34+
<p>
35+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
36+
voluptua.
37+
</p>
38+
<KolButton _label="Close drawer" _on={{ onClick: () => drawerElement.current?.close() }} />
39+
</div>
3840
</KolDrawer>
3941
<KolButton _label="Open drawer" _on={{ onClick: () => drawerElement.current?.open() }} />
4042
</div>

packages/samples/react/src/style.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ hr {
4848
width: 500px;
4949
}
5050

51+
.drawer-content-vertical {
52+
width: rem(400);
53+
}
54+
5155
@media (min-width: 1024px) {
5256
.app-container {
5357
display: grid;
@@ -84,4 +88,4 @@ hr {
8488
.no-print * {
8589
display: none !important;
8690
}
87-
}
91+
}

0 commit comments

Comments
 (0)