Skip to content

Commit 84985d1

Browse files
committed
Add height='auto' support for readonly mode and height customization in demo
1 parent c1bfb10 commit 84985d1

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

demo-bootstrap.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ <h5 class="card-title">Component Props Editor</h5>
104104
</label>
105105
</div>
106106
</div>
107+
108+
<div class="col-md-6">
109+
<label for="propHeight" class="form-label">
110+
<strong>height</strong> - Component height (e.g., "500px", "auto")
111+
</label>
112+
<input type="text" class="form-control" id="propHeight" value="500px">
113+
</div>
107114
</div>
108115

109116
<div class="mt-3">
@@ -396,6 +403,7 @@ <h5 class="card-title">Usage Example</h5>
396403
// Props Editor: Apply Props button handler
397404
document.getElementById('applyPropsBtn').addEventListener('click', () => {
398405
const isReadOnly = document.getElementById('propReadOnly').checked;
406+
const heightValue = document.getElementById('propHeight').value.trim() || '500px';
399407

400408
const props = {
401409
showCloseButton: document.getElementById('propShowCloseButton').checked,
@@ -404,7 +412,8 @@ <h5 class="card-title">Usage Example</h5>
404412
hideToggleButton: document.getElementById('propHideToggleButton').checked,
405413
hideDeliveryMethod: document.getElementById('propHideDeliveryMethod').checked,
406414
readOnly: isReadOnly,
407-
disableClosedConversations: document.getElementById('propDisableClosedConversations').checked
415+
disableClosedConversations: document.getElementById('propDisableClosedConversations').checked,
416+
height: heightValue
408417
};
409418

410419
// If readonly mode is enabled, inject the active conversation
@@ -447,6 +456,7 @@ <h5 class="card-title">Usage Example</h5>
447456
document.getElementById('propHideDeliveryMethod').checked = false;
448457
document.getElementById('propReadOnly').checked = false;
449458
document.getElementById('propDisableClosedConversations').checked = false;
459+
document.getElementById('propHeight').value = '500px';
450460

451461
// Get current state before reinitializing
452462
const currentState = ChatComponent.useChatStore.getState().exportState();

src/components/ChatComponent.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const ChatComponent = ({
100100
<div
101101
role="region"
102102
aria-label="Chat"
103-
className={`chat-component-root tw-flex tw-flex-col tw-overflow-hidden tw-border tw-rounded-lg ${className}`}
103+
className={`chat-component-root tw-flex tw-flex-col tw-border tw-rounded-lg ${className}`}
104104
style={{
105105
height,
106106
maxWidth,
@@ -121,8 +121,8 @@ const ChatComponent = ({
121121
</div>
122122

123123
{/* Read-only message thread */}
124-
<div className="tw-flex tw-flex-1 tw-overflow-hidden tw-h-full">
125-
<div className="tw-flex tw-flex-col tw-flex-1 tw-bg-white tw-m-3.5 tw-rounded-lg tw-shadow-sm tw-overflow-hidden">
124+
<div className="tw-flex">
125+
<div className="tw-flex tw-flex-col tw-flex-1 tw-bg-white tw-m-3.5 tw-rounded-lg tw-shadow-sm">
126126
<MessageThread
127127
currentUserId={currentUserId}
128128
readOnlyConversation={conversation}

0 commit comments

Comments
 (0)