Skip to content

Commit b0d8a22

Browse files
fix(Chat): Show suggestions below input (if configured) when there's no header. (#1908)
--------- Co-authored-by: sivanova <[email protected]> Co-authored-by: Silvia Ivanova <[email protected]>
1 parent 31923e4 commit b0d8a22

File tree

3 files changed

+34
-28
lines changed

3 files changed

+34
-28
lines changed

src/components/chat/chat.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ describe('Chat', () => {
312312
await elementUpdated(chat);
313313

314314
const { input, suggestionsContainer } = getChatDOM(chat);
315-
expect(suggestionsContainer.getBoundingClientRect().top).lessThanOrEqual(
316-
input.self.getBoundingClientRect().bottom
317-
);
315+
expect(
316+
suggestionsContainer.getBoundingClientRect().top
317+
).greaterThanOrEqual(input.self.getBoundingClientRect().bottom);
318318
});
319319

320320
it('should render typing indicator if `isTyping` is true', async () => {

src/components/chat/chat.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -502,27 +502,29 @@ export default class IgcChatComponent extends EventEmitterMixin<
502502
: nothing}
503503
</div>
504504
505-
<igc-chat-input
506-
exportparts="
507-
input-container: input-area-container,
508-
input-wrapper: input-container,
509-
attachments: input-attachments-container,
510-
attachment-wrapper: input-attachment-container,
511-
attachment-name: input-attachment-name,
512-
attachment-icon: input-attachment-icon,
513-
text-input,
514-
actions-container: input-actions-container,
515-
input-actions-start,
516-
input-actions-end,
517-
file-upload-container,
518-
file-upload,
519-
send-button-container,
520-
send-button"
521-
>
522-
</igc-chat-input>
523-
${this._state.suggestionsPosition === 'below-input'
524-
? suggestions
525-
: nothing}
505+
<div part="input-area-container">
506+
<igc-chat-input
507+
exportparts="
508+
input-container: input-area-container,
509+
input-wrapper: input-container,
510+
attachments: input-attachments-container,
511+
attachment-wrapper: input-attachment-container,
512+
attachment-name: input-attachment-name,
513+
attachment-icon: input-attachment-icon,
514+
text-input,
515+
actions-container: input-actions-container,
516+
input-actions-start,
517+
input-actions-end,
518+
file-upload-container,
519+
file-upload,
520+
send-button-container,
521+
send-button"
522+
>
523+
</igc-chat-input>
524+
${this._state.suggestionsPosition === 'below-input'
525+
? suggestions
526+
: nothing}
527+
</div>
526528
</div>
527529
`;
528530
}

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,28 @@ $inline-inset: rem(24px);
2525
height: 100%;
2626
}
2727

28+
[part='input-area-container'],
2829
[part='message-area-container'] {
2930
display: grid;
3031
grid-template-columns: subgrid;
3132
overflow: hidden auto;
3233
grid-column: 1 / -1;
3334
grid-template-rows: auto 1fr;
3435
align-items: start;
36+
}
37+
38+
[part='message-area-container'] {
3539
grid-row: 2;
3640

3741
&:has([part='empty-state']) {
3842
grid-template-rows: 1fr auto;
3943
}
4044
}
4145

46+
[part='input-area-container'] {
47+
grid-row: 3;
48+
}
49+
4250
[part='message-list'],
4351
[part='empty-state'],
4452
[part='suggestions-container'] {
@@ -125,10 +133,6 @@ slot[name='prefix'] {
125133
margin-inline-end: rem(32px);
126134
}
127135

128-
igc-chat-input {
129-
grid-row: 3;
130-
}
131-
132136
igc-list {
133137
--ig-size: 3;
134138

0 commit comments

Comments
 (0)