Skip to content

Commit 4332fba

Browse files
authored
feat(ui): add scroll-to-bottom button (#10186)
1 parent 3a9f374 commit 4332fba

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

apps/desktop/src/components/codegen/CodegenChatLayout.svelte

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import ConfigurableScrollableContainer from '$components/ConfigurableScrollableContainer.svelte';
3+
import { Button } from '@gitbutler/ui';
34
import { focusable } from '@gitbutler/ui/focus/focusable';
45
import type { Snippet } from 'svelte';
56
@@ -41,11 +42,22 @@
4142
</div>
4243
</div>
4344

44-
<ConfigurableScrollableContainer bind:this={scrollableContainer} childrenWrapHeight="100%">
45-
<div class="chat-messages hide-native-scrollbar">
46-
{@render messages()}
45+
<div class="chat-container">
46+
<ConfigurableScrollableContainer bind:this={scrollableContainer} childrenWrapHeight="100%">
47+
<div class="chat-messages">
48+
{@render messages()}
49+
</div>
50+
</ConfigurableScrollableContainer>
51+
52+
<div class="chat-scroll-to-bottom">
53+
<Button
54+
kind="outline"
55+
icon="arrow-down"
56+
tooltip="Scroll to bottom"
57+
onclick={scrollToBottom}
58+
/>
4759
</div>
48-
</ConfigurableScrollableContainer>
60+
</div>
4961

5062
<div class="chat-footer" use:focusable>
5163
{@render input()}
@@ -72,6 +84,12 @@
7284
border-bottom: 1px solid var(--clr-border-3);
7385
}
7486
87+
.chat-container {
88+
position: relative;
89+
flex: 1;
90+
overflow: hidden;
91+
}
92+
7593
.chat-messages {
7694
display: flex;
7795
flex-direction: column;
@@ -87,4 +105,22 @@
87105
padding: 16px;
88106
border-top: 1px solid var(--clr-border-2);
89107
}
108+
109+
.chat-scroll-to-bottom {
110+
z-index: 10;
111+
position: absolute;
112+
right: 16px;
113+
bottom: 14px;
114+
overflow: hidden;
115+
border-radius: var(--radius-btn);
116+
background-color: var(--clr-bg-1);
117+
transition:
118+
box-shadow var(--transition-fast),
119+
transform var(--transition-medium);
120+
121+
&:hover {
122+
transform: translateY(-2px);
123+
box-shadow: var(--fx-shadow-s);
124+
}
125+
}
90126
</style>

0 commit comments

Comments
 (0)