Skip to content

Commit defe741

Browse files
committed
feat: Hide chat behind input when scrolling
1 parent 3d1108c commit defe741

File tree

3 files changed

+103
-6
lines changed

3 files changed

+103
-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;
@@ -60,10 +62,15 @@ shiny-chat-message {
6062
}
6163

6264
shiny-chat-input {
65+
--_input-padding-top: 1rem;
66+
--_input-padding-bottom: var(--_chat-container-padding, 0.25rem);
67+
6368
margin-top: auto;
6469
position: sticky;
65-
background-color: var(--bs-body-bg, white);
6670
bottom: 0;
71+
background: linear-gradient(to bottom, transparent, var(--bs-body-bg, white) calc(var(--_input-padding-top) - var(--_input-padding-bottom)));
72+
padding-block: var(--_input-padding-top) var(--_input-padding-bottom);
73+
6774
textarea {
6875
--bs-border-radius: 26px;
6976
resize: none;
@@ -75,7 +82,7 @@ shiny-chat-input {
7582
}
7683
button {
7784
position: absolute;
78-
bottom: 7px;
85+
bottom: calc(6px + var(--_input-padding-bottom));
7986
right: 8px;
8087
background-color: transparent;
8188
color: var(--bs-primary, #007bc2);

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

Lines changed: 91 additions & 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)