refac: styling

This commit is contained in:
Timothy Jaeryang Baek 2025-06-03 21:51:12 +04:00
parent 0a1ff4a8fa
commit abae0a837f
3 changed files with 31 additions and 7 deletions

View File

@ -304,7 +304,7 @@
message.followUps = data.follow_ups;
if (autoScroll) {
scrollToBottom();
scrollToBottom('smooth');
}
} else if (type === 'chat:title') {
chatTitle.set(data);
@ -919,10 +919,13 @@
}
};
const scrollToBottom = async () => {
const scrollToBottom = async (behavior = 'auto') => {
await tick();
if (messagesContainerElement) {
messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight;
messagesContainerElement.scrollTo({
top: messagesContainerElement.scrollHeight,
behavior
});
}
};
const chatCompletedHandler = async (chatId, modelId, responseMessageId, messages) => {

View File

@ -1,4 +1,5 @@
<script lang="ts">
import ArrowTurnDownRight from '$lib/components/icons/ArrowTurnDownRight.svelte';
import { onMount, tick, getContext } from 'svelte';
const i18n = getContext('i18n');
@ -7,21 +8,29 @@
export let onClick: (followUp: string) => void = () => {};
</script>
<div class="mt-2">
<div class="text-xs text-gray-500 font-medium">
<div class="mt-4">
<div class="text-sm font-medium">
{$i18n.t('Follow up')}
</div>
<div class="flex flex-col text-left gap-1 mt-1.5">
{#each followUps as followUp, idx (idx)}
<button
class=" mr-2 py-1 bg-transparent text-left text-xs"
class=" mr-2 py-1.5 bg-transparent text-left text-sm flex items-center gap-2 px-1 text-gray-500 dark:text-gray-400 hover:text-black dark:hover:text-white transition"
on:click={() => onClick(followUp)}
title={followUp}
aria-label={followUp}
>
{followUp}
<ArrowTurnDownRight className="size-3.5" />
<div class="line-clamp-1">
{followUp}
</div>
</button>
{#if idx < followUps.length - 1}
<hr class="border-gray-100 dark:border-gray-850" />
{/if}
{/each}
</div>
</div>

View File

@ -0,0 +1,12 @@
<script lang="ts">
export let className = 'size-4';
export let strokeWidth = '1.5';
</script>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class={className}>
<path
fill-rule="evenodd"
d="M2.75 2a.75.75 0 0 1 .75.75v6.5h7.94l-.97-.97a.75.75 0 0 1 1.06-1.06l2.25 2.25a.75.75 0 0 1 0 1.06l-2.25 2.25a.75.75 0 1 1-1.06-1.06l.97-.97H2.75A.75.75 0 0 1 2 10V2.75A.75.75 0 0 1 2.75 2Z"
clip-rule="evenodd"
/>
</svg>