refac: styling

This commit is contained in:
Timothy J. Baek 2024-05-01 22:55:42 -07:00
parent 6d378844ae
commit 84cd1b8cb8
2 changed files with 36 additions and 26 deletions

View file

@ -1,4 +1,6 @@
<script lang="ts"> <script lang="ts">
import Bolt from '$lib/components/icons/Bolt.svelte';
export let submitPrompt: Function; export let submitPrompt: Function;
export let suggestionPrompts = []; export let suggestionPrompts = [];
@ -12,20 +14,27 @@
// : suggestionPrompts.sort(() => Math.random() - 0.5).slice(0, 4); // : suggestionPrompts.sort(() => Math.random() - 0.5).slice(0, 4);
</script> </script>
{#if prompts.length > 0}
<div class="mb-2 flex gap-1 text-sm font-medium items-center text-gray-400 dark:text-gray-600">
<Bolt />
Suggested
</div>
{/if}
<div class="w-full"> <div class="w-full">
<div class="relative w-full flex gap-2 snap-x overflow-x-auto tabs"> <div class="relative w-full flex gap-2 snap-x overflow-x-auto tabs">
{#each prompts as prompt, promptIdx} {#each prompts as prompt, promptIdx}
<div class="shrink-0"> <div class="shrink-0">
<button <button
class="flex flex-1 shrink-0 w-64 justify-between h-full px-5 py-3 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 rounded-2xl transition group" class="flex flex-col flex-1 shrink-0 w-64 justify-between h-36 p-5 px-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 rounded-3xl transition group"
on:click={() => { on:click={() => {
submitPrompt(prompt.content); submitPrompt(prompt.content);
}} }}
> >
<div class="flex flex-col text-left self-center"> <div class="flex flex-col text-left">
{#if prompt.title && prompt.title[0] !== ''} {#if prompt.title && prompt.title[0] !== ''}
<div class="text-sm font-medium dark:text-gray-300">{prompt.title[0]}</div> <div class=" font-medium dark:text-gray-300">{prompt.title[0]}</div>
<div class="text-sm text-gray-500 font-normal line-clamp-1">{prompt.title[1]}</div> <div class="text-sm text-gray-600 font-normal line-clamp-2">{prompt.title[1]}</div>
{:else} {:else}
<div class=" self-center text-sm font-medium dark:text-gray-300 line-clamp-2"> <div class=" self-center text-sm font-medium dark:text-gray-300 line-clamp-2">
{prompt.content} {prompt.content}
@ -33,14 +42,17 @@
{/if} {/if}
</div> </div>
<div class="w-full flex justify-between">
<div class="text-xs text-gray-400 dark:text-gray-600 self-center">Prompt</div>
<div <div
class="self-center p-1 rounded-lg text-gray-50 group-hover:text-gray-800 dark:text-gray-850 dark:group-hover:text-gray-100 transition" class="self-end p-1 rounded-lg text-gray-300 group-hover:text-gray-800 dark:text-gray-700 dark:group-hover:text-gray-100 transition"
> >
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16" viewBox="0 0 16 16"
fill="currentColor" fill="currentColor"
class="w-4 h-4" class="size-4"
> >
<path <path
fill-rule="evenodd" fill-rule="evenodd"
@ -49,6 +61,7 @@
/> />
</svg> </svg>
</div> </div>
</div>
</button> </button>
</div> </div>
{/each} {/each}

View file

@ -25,9 +25,9 @@
</script> </script>
{#if models.length > 0} {#if models.length > 0}
<div class="m-auto w-full max-w-3xl px-8 pb-24"> <div class="m-auto w-full max-w-3xl px-8 pb-32">
<!-- <div class="flex justify-start"> <div class="flex justify-start">
<div class="flex -space-x-4 mb-0.5"> <div class="flex -space-x-4 mb-1">
{#each models as model, modelIdx} {#each models as model, modelIdx}
<button <button
on:click={() => { on:click={() => {
@ -54,7 +54,8 @@
</button> </button>
{/each} {/each}
</div> </div>
</div> --> </div>
<div <div
class=" mt-2 mb-4 text-3xl text-gray-800 dark:text-gray-100 font-semibold text-left flex items-center gap-4" class=" mt-2 mb-4 text-3xl text-gray-800 dark:text-gray-100 font-semibold text-left flex items-center gap-4"
> >
@ -84,10 +85,6 @@
</div> </div>
<div class=" w-full"> <div class=" w-full">
<div class="mb-2 flex gap-1 text-sm font-medium items-center dark:text-gray-600">
<Bolt />
Suggested
</div>
<Suggestions {suggestionPrompts} {submitPrompt} /> <Suggestions {suggestionPrompts} {submitPrompt} />
</div> </div>
</div> </div>