Skip to content

Commit 10a91ac

Browse files
committed
feat(chat): Add customizable chat height via --igc-chat-height variable
-- Make sure we dont directly target host component tags
1 parent 310c645 commit 10a91ac

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/components/chat/chat.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ export default class IgcChatComponent extends EventEmitterMixin<
317317
? html`<div part="empty-state">
318318
<slot name="empty-state"> </slot>
319319
</div>`
320-
: html`<igc-chat-message-list> </igc-chat-message-list>`}
320+
: html`<igc-chat-message-list part="chat-messages">
321+
</igc-chat-message-list>`}
321322
${hasSuggestions &&
322323
this._chatState.suggestionsPosition === 'below-messages'
323324
? this.renderSuggestions()

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
$inline-inset: rem(16px);
55

66
:host {
7+
--igc-chat-height: 100%;
8+
79
width: 100%;
8-
height: 100vh;
10+
height: var(--igc-chat-height);
911
overflow: hidden;
1012
box-shadow: var(--ig-elevation-24);
1113
display: flex;
@@ -20,7 +22,7 @@ $inline-inset: rem(16px);
2022
gap: rem(24px);
2123
}
2224

23-
igc-chat-message-list,
25+
[part='chat-messages'],
2426
[part='empty-state'],
2527
[part='suggestions-container'] {
2628
max-width: calc(rem(760px) + $inline-inset * 2);

stories/chat.stories.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ export const Basic: Story = {
573573
messages = initialMessages;
574574
return html`
575575
<igc-chat
576+
style="--igc-chat-height: calc(100vh - 32px);"
576577
.messages=${messages}
577578
.options=${chat_options}
578579
@igcMessageCreated=${handleMessageSend}
@@ -593,13 +594,18 @@ export const Supabase: Story = {
593594
});
594595
},
595596
render: () => html`
596-
<igc-chat @igcMessageCreated=${handleMessageCreatedSupabase}> </igc-chat>
597+
<igc-chat
598+
style="--igc-chat-height: calc(100vh - 32px);"
599+
@igcMessageCreated=${handleMessageCreatedSupabase}
600+
>
601+
</igc-chat>
597602
`,
598603
};
599604

600605
export const AI: Story = {
601606
render: () => html`
602607
<igc-chat
608+
style="--igc-chat-height: calc(100vh - 32px);"
603609
.draftMessage=${draftMessage}
604610
.options=${ai_chat_options}
605611
@igcMessageCreated=${handleAIMessageSend}
@@ -637,6 +643,7 @@ export const Chat_Templates: Story = {
637643
messages = [];
638644
return html`
639645
<igc-chat
646+
style="--igc-chat-height: calc(100vh - 32px);"
640647
.messages=${messages}
641648
.options=${options}
642649
@igcMessageCreated=${handleMessageSend}

0 commit comments

Comments
 (0)