|
1 | 1 | <script lang="ts"> |
| 2 | + import { slide } from 'svelte/transition'; |
2 | 3 | import {format} from 'date-fns'; |
3 | 4 | import avatar from '$lib/assets/avatar.png'; |
4 | 5 | import type {PageData} from '../../routes/$types'; |
|
7 | 8 |
|
8 | 9 | let {data, config}: {data: PageData; config: any} = $props(); |
9 | 10 | const memoList = createMemoList(() => data, config); |
| 11 | +
|
| 12 | + $effect(() => { |
| 13 | + if (memoList.selectedTag) { |
| 14 | + window.scrollTo({ top: 0, behavior: 'smooth' }); |
| 15 | + } |
| 16 | + }); |
10 | 17 | </script> |
11 | 18 |
|
12 | 19 | <div class="flex justify-center sm:m-10 min-h-screen {config.theme} relative isolate"> |
|
46 | 53 | }} |
47 | 54 | role="presentation" |
48 | 55 | > |
49 | | - {#each Object.entries(memoList.groupedMemos) as [dateKey, memos]} |
50 | | - <div class="mb-[30px]"> |
| 56 | + {#each Object.entries(memoList.groupedMemos) as [dateKey, memos] (dateKey)} |
| 57 | + <div class="mb-[30px]" in:slide> |
51 | 58 | <div class="text-center mb-4 font-bold text-sm"> |
52 | 59 | <span>*** {format(new Date(dateKey + 'T00:00:00'), 'MMM dd, yyyy').toUpperCase()} ***</span> |
53 | 60 | </div> |
54 | 61 |
|
55 | | - {#each memos as memo} |
56 | | - <div class="flex gap-2 mb-4 items-start -mx-1" id={memo.slug}> |
| 62 | + {#each memos as memo (memo.slug)} |
| 63 | + <div class="flex gap-2 mb-4 items-start -mx-1" id={memo.slug} in:slide> |
57 | 64 | <div class="flex flex-col items-center gap-1 w-10 shrink-0 mt-4"> |
58 | 65 | <div class="w-8 h-8 md:w-9 md:h-9 rounded-full overflow-hidden"> |
59 | 66 | <img |
|
69 | 76 | class="flex-1 text-[0.95rem] |
70 | 77 | [&_h1]:text-[1.2rem] [&_h1]:uppercase [&_h1]:font-black [&_h1]:mb-2 [&_h1]:mt-4 |
71 | 78 | [&_h2]:text-[1.1rem] [&_h2]:uppercase [&_h2]:font-bold [&_h2]:mb-2 [&_h2]:mt-4 |
72 | | - [&_h3]:text-[1.05rem] [&_h3]:font-bold [&_h3]:mb-1.5 [&_h3]:mt-3 |
| 79 | + [&_h3]:text-[1.0rem] [&_h3]:font-bold [&_h3]:mb-1.5 [&_h3]:mt-3 |
73 | 80 | [&_h4]:text-[0.9rem] [&_h4]:font-bold [&_h4]:mb-1 [&_h4]:mt-2 |
74 | 81 | [&_h5]:text-[0.8rem] [&_h5]:font-bold [&_h5]:italic [&_h5]:mb-1 |
75 | 82 | [&_p]:my-4 [&_img]:grayscale [&_img]:contrast-120 [&_img]:max-w-full [&_img]:my-5 [&_img]:border-2 [&_img]:border-black |
|
95 | 102 | <p class="text-center">NO DATA.</p> |
96 | 103 | {/if} |
97 | 104 |
|
98 | | - {#if memoList.visibleCount < data.memos.length} |
| 105 | + {#if memoList.visibleCount < memoList.filteredMemos.length} |
99 | 106 | <div class="text-center my-5"> |
100 | 107 | <button |
101 | 108 | class="bg-transparent border-2 dashed border-black px-4 py-1 text-xs cursor-pointer uppercase font-bold hover:bg-black hover:text-white transition-colors" |
|
0 commit comments