Skip to content

Commit 33bf25d

Browse files
gadenbuiecpsievert
andauthored
feat: Hide chat behind input when scrolling (#1848)
Co-authored-by: Carson <[email protected]>
1 parent f540a30 commit 33bf25d

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

js/chat/chat.scss

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
shiny-chat-container {
22
--shiny-chat-border: var(--bs-border-width, 1px) solid var(--bs-border-color, #e9ecef);
33
--shiny-chat-user-message-bg: RGBA(var(--bs-primary-rgb, 0, 123, 194), 0.06);
4+
--_chat-container-padding: 0.25rem;
45

56
display: flex;
67
flex-direction: column;
78
margin: 0 auto;
89
gap: 1rem;
910
overflow: auto;
10-
padding: 0.25rem;
11+
padding: var(--_chat-container-padding);
12+
padding-bottom: 0; // Bottom padding is on input element
1113

1214
p:last-child {
1315
margin-bottom: 0;
@@ -94,10 +96,15 @@ shiny-chat-message {
9496
}
9597

9698
shiny-chat-input {
99+
--_input-padding-top: 1rem;
100+
--_input-padding-bottom: var(--_chat-container-padding, 0.25rem);
101+
97102
margin-top: auto;
98103
position: sticky;
99-
background-color: var(--bs-body-bg, white);
100104
bottom: 0;
105+
background: linear-gradient(to bottom, transparent, var(--bs-body-bg, white) calc(var(--_input-padding-top) - var(--_input-padding-bottom)));
106+
padding-block: var(--_input-padding-top) var(--_input-padding-bottom);
107+
101108
textarea {
102109
--bs-border-radius: 26px;
103110
resize: none;
@@ -109,7 +116,7 @@ shiny-chat-input {
109116
}
110117
button {
111118
position: absolute;
112-
bottom: 7px;
119+
bottom: calc(6px + var(--_input-padding-bottom));
113120
right: 8px;
114121
background-color: transparent;
115122
color: var(--bs-primary, #007bc2);

shiny/www/py-shiny/chat/chat.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

shiny/www/py-shiny/chat/chat.css.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)