Skip to content

Commit 243eae7

Browse files
committed
feat(chat): send button style
1 parent 738a5bd commit 243eae7

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

components/AutoExpandTextArea.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const emit = defineEmits<{
1919
2020
const props = defineProps<{
2121
modelValue?: string
22+
minHeight?: number
2223
}>()
2324
2425
const textareaRef = ref<HTMLTextAreaElement | null>(null)
@@ -30,11 +31,12 @@ watch(inputValue, async () => {
3031
await nextTick()
3132
const textarea = textareaRef.value as HTMLTextAreaElement
3233
if (!textarea) return
33-
textarea.style.height = 'auto' // Reset height to auto to shrink if needed
34+
textarea.style.height = '0px' // Reset height to auto to shrink if needed
3435
// force a reflow to ensure the height is recalculated
3536
const _ = textarea.offsetHeight
3637
const scrollHeight = textarea.scrollHeight
37-
textarea.style.height = `${scrollHeight}px` // Set height to scrollHeight to expand
38+
const height = Math.max(props.minHeight || 0, scrollHeight)
39+
textarea.style.height = `${height}px` // Set height to scrollHeight to expand
3840
})
3941
4042
const onInput = (event: Event) => {

entrypoints/content/components/Chat/index.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@
5454
</div>
5555
<div class="flex gap-1 relative">
5656
<ScrollContainer
57-
class="max-h-72 grow shadow-02 bg-white rounded-md"
58-
itemContainerClass="p-1"
57+
class="max-h-72 grow shadow-02 bg-white rounded-md overflow-hidden"
58+
itemContainerClass="px-2 py-[7px]"
59+
:style="{ paddingRight: `${sendButtonContainerWidth}px` }"
5960
>
60-
<div class="flex gap-1 items-stretch">
61+
<div class="h-max min-h-[30px] grid place-items-center">
6162
<AutoExpandTextArea
6263
v-model="userInput"
6364
maxlength="2000"
@@ -67,8 +68,7 @@
6768
? 'Ask anything...'
6869
: 'Ask follow up...'
6970
"
70-
class="w-full block outline-none border-none resize-none p-2 field-sizing-content leading-5 text-sm wrap-anywhere"
71-
:style="{ paddingRight: `${sendButtonContainerWidth}px` }"
71+
class="w-full block outline-none border-none resize-none field-sizing-content leading-5 text-sm wrap-anywhere"
7272
@keydown="onKeydown"
7373
@compositionstart="isComposing = true"
7474
@compositionend="isComposing = false"
@@ -77,20 +77,20 @@
7777
</ScrollContainer>
7878
<div
7979
ref="sendButtonContainerRef"
80-
class="absolute right-0 top-0 bottom-0 p-1"
80+
class="absolute right-0 top-0 bottom-0 p-2 pl-0"
8181
>
8282
<Button
8383
v-if="chat.isAnswering()"
8484
variant="secondary"
85-
class="px-2 grow-0 shrink-0 h-full"
85+
class="px-[6px] grow-0 shrink-0 h-7"
8686
@click="onStop"
8787
>
8888
{{ "Stop" }}
8989
</Button>
9090
<Button
9191
v-else
9292
variant="primary"
93-
class="px-2 grow-0 shrink-0 h-full"
93+
class="px-[6px] grow-0 shrink-0 h-7"
9494
:disabled="!allowAsk"
9595
@click="onSubmit"
9696
>

0 commit comments

Comments
 (0)