Skip to content

Commit 91c3ffe

Browse files
authored
feat(chat): refactor layout to use CSS Grid for improved structure and flexibility (#1839)
* feat(chat): refactor layout to use CSS Grid for improved structure and flexibility * feat(chat): refine CSS Grid layout for better responsiveness and alignment * feat(chat): adjust Grid layout for improved responsiveness with dynamic min-width
1 parent c139b7c commit 91c3ffe

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/components/chat/themes/chat.base.scss

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,27 @@ $inline-inset: rem(16px);
1414
}
1515

1616
[part='chat-container'] {
17-
display: flex;
18-
flex-direction: column;
19-
align-items: center;
17+
display: grid;
18+
grid-template-columns: 1fr minmax(rem(320px), #{calc(rem(760px) + $inline-inset * 2)}) 1fr;
19+
grid-template-rows: auto 1fr auto;
2020
height: 100%;
2121
}
2222

2323
[part='chat-wrapper'] {
24-
display: flex;
25-
flex-direction: column;
26-
overflow: hidden auto;
27-
width: 100%;
28-
flex: 1;
29-
align-items: center;
24+
display: grid;
25+
grid-template-columns: subgrid;
26+
overflow: hidden auto;
27+
grid-column: 1 / -1;
28+
grid-template-rows: 1fr auto;
29+
align-items: start;
3030
}
3131

3232
[part='message-list'],
3333
[part='empty-state'],
3434
[part='suggestions-container'] {
35-
display: block;
36-
max-width: calc(rem(760px) + $inline-inset * 2);
35+
grid-column: 2 / 3;
36+
display: grid;
37+
grid-template-columns: subgrid;
3738
width: 100%;
3839
padding-inline: $inline-inset;
3940
}
@@ -44,7 +45,7 @@ $inline-inset: rem(16px);
4445
}
4546

4647
[part='empty-state'] {
47-
height: 100%;
48+
height: 100%;
4849
}
4950

5051
[part='header'] {
@@ -55,6 +56,8 @@ $inline-inset: rem(16px);
5556
box-shadow: var(--ig-elevation-4);
5657
width: 100%;
5758
z-index: 1;
59+
grid-column: 1 / -1;
60+
grid-row: 1 / 2;
5861
}
5962

6063
[part='typing-indicator'] {

src/components/chat/themes/input.base.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
width: 100%;
88
padding-block: rem(16px);
99
justify-content: center;
10+
grid-column: 2 / 3;
1011
}
1112

1213
[part~='input-container'] {
1314
display: flex;
1415
flex-direction: column;
15-
max-width: rem(760px);
1616
width: 100%;
1717
margin-inline: rem(16px);
1818
border-radius: rem(4px);

0 commit comments

Comments
 (0)