Skip to content

Commit f0563d6

Browse files
committed
fix: enhance drawer component styles for better layout and responsiveness
Refs: #7487
1 parent ba12c49 commit f0563d6

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
@layer kol-component {
55
.kol-drawer {
6+
$root: &;
67
font-size: rem(16);
78

89
&__dialog {
@@ -21,27 +22,43 @@
2122
left: 0;
2223
height: 100vh;
2324
max-height: 100%;
25+
26+
#{$root}__content {
27+
height: 100%;
28+
}
2429
}
2530

2631
&--right {
2732
top: 0;
2833
right: 0;
2934
height: 100vh;
3035
max-height: 100%;
36+
37+
#{$root}__content {
38+
height: 100%;
39+
}
3140
}
3241

3342
&--top {
3443
left: 0;
3544
top: 0;
3645
width: 100vw;
3746
max-width: 100%;
47+
48+
#{$root}__content {
49+
width: 100%;
50+
}
3851
}
3952

4053
&--bottom {
4154
left: 0;
4255
bottom: 0;
4356
width: 100vw;
4457
max-width: 100%;
58+
59+
#{$root}__content {
60+
width: 100%;
61+
}
4562
}
4663
}
4764

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)