Skip to content

Commit 2e75c91

Browse files
authored
Merge branch 'moirelog:main' into main
2 parents eeb9bb3 + 2097c36 commit 2e75c91

8 files changed

Lines changed: 73 additions & 20 deletions

File tree

src/lib/memo.svelte.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export function createMemoList(getData: () => any, config: any) {
4040

4141
function selectTag(tag: string | null) {
4242
selectedTag = selectedTag === tag ? null : tag;
43+
visibleCount = config.pageSize || 20;
4344
}
4445

4546
return {

src/themes/academic/index.svelte

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
<script lang="ts">
2+
import { slide } from 'svelte/transition';
23
import {format} from 'date-fns';
34
import type {PageData} from '../../routes/$types';
45
import {createMemoList} from '$lib/memo.svelte';
56
import Background from './Background.svelte';
67
78
let {data, config}: {data: PageData; config: any} = $props();
89
const memoList = createMemoList(() => data, config);
10+
11+
$effect(() => {
12+
if (memoList.selectedTag) {
13+
window.scrollTo({ top: 0, behavior: 'smooth' });
14+
}
15+
});
916
</script>
1017

1118
<div class="max-w-4xl mx-auto min-h-screen text-[var(--text-color)] p-5 md:p-10 {config.theme} relative isolate">
@@ -65,8 +72,8 @@
6572
</aside>
6673

6774
<main class="md:col-span-9 space-y-16 max-w-2xl">
68-
{#each Object.entries(memoList.groupedMemos) as [dateKey, memos]}
69-
<section>
75+
{#each Object.entries(memoList.groupedMemos) as [dateKey, memos] (dateKey)}
76+
<section in:slide>
7077
<div class="flex items-baseline gap-4 mb-10 border-b border-[var(--text-color)] pb-3">
7178
<h2 class="text-3xl font-black italic text-[var(--text-color)] tracking-tight">
7279
{format(new Date(dateKey + 'T00:00:00'), 'MMMM dd, yyyy')}
@@ -77,8 +84,9 @@
7784
</div>
7885

7986
<div class="space-y-14">
80-
{#each memos as memo}
87+
{#each memos as memo (memo.slug)}
8188
<article
89+
in:slide
8290
class="group relative"
8391
id={memo.slug}
8492
>
@@ -102,7 +110,7 @@
102110
[&_a]:text-[var(--accent-color)] [&_a]:no-underline [&_a]:border-b [&_a]:border-[var(--accent-color)]/30 [&_a]:underline-offset-4 [&_a]:hover:border-[var(--accent-color)] [&_a]:hover:bg-[var(--accent-color)]/5 [&_a]:transition-all
103111
[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5
104112
[&_p]:my-4
105-
[&_table]:border-collapse [&_table]:border-y-1 [&_table]:border-black [&_table]:my-6 [&_table]:w-full [&_table]:text-sm
113+
[&_table]:border-collapse [&_table]:border-y-1 [&_table]:border-black [&_table]:my-6 [&_table]:w-full [&_table]:text-xs
106114
[&_th]:border-b-1 [&_th]:border-black [&_th]:border-dashed [&_th]:font-bold [&_th]:p-3 [&_th]:text-center [&_th]:uppercase
107115
[&_td]:border-b [&_td]:border-[var(--text-color)]/10 [&_td]:border-dashed [&_td]:p-3 [&_td]:text-center
108116
[&_blockquote]:border-l-4 [&_blockquote]:italic [&_blockquote]:border-[var(--accent-color)] [&_blockquote]:bg-[var(--accent-color)]/5 [&_blockquote_p]:py-3 [&_blockquote]:px-4 [&_blockquote]:my-4 [&_blockquote]:not-italic [&_blockquote]:text-[0.95rem] [&_blockquote]:text-[var(--text-color)]/80 [&_blockquote]:rounded-r-sm
@@ -127,7 +135,7 @@
127135
</section>
128136
{/each}
129137

130-
{#if memoList.visibleCount < data.memos.length}
138+
{#if memoList.visibleCount < memoList.filteredMemos.length}
131139
<div class="pt-12 text-center border-t border-[#333]/10">
132140
<button
133141
class="text-lg italic text-[#666] hover:text-[#d33682] transition-colors"

src/themes/bento/index.svelte

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { slide } from 'svelte/transition';
23
import {format} from 'date-fns';
34
import {config} from '../../../moire.config';
45
import {createMemoList} from '$lib/memo.svelte';
@@ -8,6 +9,12 @@
89
let {data}: {data: PageData} = $props();
910
const memoList = createMemoList(() => data, config);
1011
12+
$effect(() => {
13+
if (memoList.selectedTag) {
14+
window.scrollTo({ top: 0, behavior: 'smooth' });
15+
}
16+
});
17+
1118
function handleMouseMove(e: MouseEvent) {
1219
const target = e.currentTarget as HTMLElement;
1320
const rect = target.getBoundingClientRect();
@@ -45,9 +52,10 @@
4552
</header>
4653

4754
<div class="mx-auto grid grid-cols-1 gap-6 px-4 2xl:grid-cols-2" data-selected-tag={memoList.selectedTag}>
48-
{#each memoList.visibleMemos as memo, i}
55+
{#each memoList.visibleMemos as memo, i (memo.slug)}
4956
<div
5057
class="group relative flex h-full flex-col justify-between overflow-hidden rounded-2xl md:rounded-[2rem] border border-white/50 bg-white/30 p-3 md:p-7 shadow-sm backdrop-blur-3xl backdrop-saturate-150 transition-all duration-300 hover:-translate-y-1 hover:shadow-[0_20px_40px_-15px_rgba(0,0,0,0.1)] animate-in fade-in slide-in-from-bottom-8 duration-700"
58+
in:slide
5159
onmousemove={handleMouseMove}
5260
id={memo.slug}
5361
style="--x: 50%; --y: 50%; animation-delay: {(i % 15) * 100}ms; animation-fill-mode: both;"
@@ -112,7 +120,7 @@
112120
</div>
113121
{/if}
114122
<footer class="mt-20 text-center text-xs mx-5 tracking-wide text-slate-500 opacity-80">
115-
<p>© {new Date().getFullYear()} {config.author} , synced from Apple Notes and powered by <a href="https://moire.blog/" target="_blank" class="hover:text-slate-600 transition-colors">Moire</a></p>
123+
<p>© {new Date().getFullYear()} {config.author}, synced from Apple Notes and powered by <a href="https://moire.blog/" target="_blank" class="hover:text-slate-600 transition-colors">Moire</a></p>
116124
</footer>
117125
</div>
118126

src/themes/classic/index.svelte

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
<script lang="ts">
2+
import { slide } from 'svelte/transition';
23
import { format } from 'date-fns';
34
import type { PageData } from '../../routes/$types';
45
import { createMemoList } from '$lib/memo.svelte';
56
67
let { data, config }: { data: PageData; config: any } = $props();
78
const memoList = createMemoList(() => data, config);
9+
10+
$effect(() => {
11+
if (memoList.selectedTag) {
12+
window.scrollTo({ top: 0, behavior: 'smooth' });
13+
}
14+
});
815
</script>
916

1017
<div class="min-h-screen bg-white text-[0.95rem] {config.theme}">
@@ -31,8 +38,8 @@
3138
</header>
3239

3340
<div class="divide-y divide-gray-100">
34-
{#each memoList.visibleMemos as memo}
35-
<article class="py-6" id={memo.slug}>
41+
{#each memoList.visibleMemos as memo (memo.slug)}
42+
<article class="py-6" id={memo.slug} in:slide>
3643
<div class="text-[0.75rem] font-400 text-gray-500 mb-2">{format(memo.date, 'MMMM d, yyyy')}</div>
3744
<div
3845
class=" leading-[1.8] text-gray-800
@@ -77,7 +84,7 @@
7784
{/each}
7885
</div>
7986

80-
{#if memoList.visibleCount < data.memos.length}
87+
{#if memoList.visibleCount < memoList.filteredMemos.length}
8188
<div class="py-6 text-center">
8289
<button
8390
class="text-[0.8rem] text-gray-400"
@@ -90,6 +97,6 @@
9097
</div>
9198

9299
<footer class="mt-16 text-center mx-9 text-[0.8rem] text-gray-400 pb-8">
93-
<p>© {new Date().getFullYear()} {config.author} , synced from Apple Notes and powered by <a href="https://moire.blog/" target="_blank" class="hover:text-gray-600 transition-colors">Moire</a></p>
100+
<p>© {new Date().getFullYear()} {config.author}, synced from Apple Notes and powered by <a href="https://moire.blog/" target="_blank" class="hover:text-gray-600 transition-colors">Moire</a></p>
94101
</footer>
95102
</div>

src/themes/cyberpunk/index.svelte

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { slide } from 'svelte/transition';
23
import {config} from '../../../moire.config';
34
import {createMemoList} from '$lib/memo.svelte';
45
import type {PageData} from '../../routes/$types';
@@ -9,6 +10,12 @@
910
let {data}: {data: PageData} = $props();
1011
const memoList = createMemoList(() => data, config);
1112
13+
$effect(() => {
14+
if (memoList.selectedTag) {
15+
window.scrollTo({ top: 0, behavior: 'smooth' });
16+
}
17+
});
18+
1219
let time = $state(new Date());
1320
let fps = $state(60);
1421
let scrollY = $state(0);
@@ -104,8 +111,9 @@
104111
class="relative z-10 pt-32 pb-32 px-4 max-w-2xl mx-auto space-y-12"
105112
data-selected-tag={memoList.selectedTag}
106113
>
107-
{#each memoList.visibleMemos as memo}
114+
{#each memoList.visibleMemos as memo (memo.slug)}
108115
<article
116+
in:slide
109117
class="group relative pl-6 border-l-2 border-[var(--text-color)]/20 hover:border-[var(--accent-color)] transition-colors duration-300"
110118
id={memo.slug}
111119
>

src/themes/global.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ body.pixel {
3939
--card-bg: #fffae8;
4040
--border-color: #a98467;
4141
--font-family: 'zpix', monospace;
42-
-webkit-font-smoothing: none;
42+
-webkit-font-smoothing: antialiased;
4343
}
4444

4545
body.classic {
@@ -82,12 +82,18 @@ ul {
8282
margin-bottom: 0.5rem;
8383
}
8484

85+
ul ul, ol ul {
86+
padding-left: 1.25rem;
87+
}
8588
ol {
8689
list-style-type: decimal;
8790
padding-left: 1.25rem;
8891
margin-bottom: 0.5rem;
8992
}
9093

94+
ol ol, ul ol {
95+
padding-left: 1.5rem;
96+
}
9197
:is(ul, ol) :is(ul, ol) {
9298
margin-bottom: 0;
9399
}

src/themes/pixel/index.svelte

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { slide } from 'svelte/transition';
23
import {config} from '../../../moire.config';
34
import {createMemoList} from '$lib/memo.svelte';
45
import type {PageData} from '../../routes/$types';
@@ -10,6 +11,12 @@
1011
let {data}: {data: PageData} = $props();
1112
const memoList = createMemoList(() => data, config);
1213
14+
$effect(() => {
15+
if (memoList.selectedTag) {
16+
window.scrollTo({ top: 0, behavior: 'smooth' });
17+
}
18+
});
19+
1320
let isMoving = $state(false);
1421
let scrollTimeout: ReturnType<typeof setTimeout>;
1522
@@ -56,8 +63,9 @@
5663
</header>
5764

5865
<div class="mx-auto grid grid-cols-1 gap-8 2xl:grid-cols-2" data-selected-tag={memoList.selectedTag}>
59-
{#each memoList.visibleMemos as memo}
66+
{#each memoList.visibleMemos as memo (memo.slug)}
6067
<article
68+
in:slide
6169
class="window-frame relative flex flex-col bg-[var(--card-bg)] border-2 border-[var(--border-color)] shadow-[4px_4px_0_0_var(--accent-color)]/50 hover:translate-y-[-2px] hover:shadow-[6px_6px_0_0_var(--accent-color)]/50 transition-all duration-200 rounded-xl overflow-hidden"
6270
id={memo.slug}
6371
>

src/themes/receipt/index.svelte

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { slide } from 'svelte/transition';
23
import {format} from 'date-fns';
34
import avatar from '$lib/assets/avatar.png';
45
import type {PageData} from '../../routes/$types';
@@ -7,6 +8,12 @@
78
89
let {data, config}: {data: PageData; config: any} = $props();
910
const memoList = createMemoList(() => data, config);
11+
12+
$effect(() => {
13+
if (memoList.selectedTag) {
14+
window.scrollTo({ top: 0, behavior: 'smooth' });
15+
}
16+
});
1017
</script>
1118

1219
<div class="flex justify-center sm:m-10 min-h-screen {config.theme} relative isolate">
@@ -46,14 +53,14 @@
4653
}}
4754
role="presentation"
4855
>
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>
5158
<div class="text-center mb-4 font-bold text-sm">
5259
<span>*** {format(new Date(dateKey + 'T00:00:00'), 'MMM dd, yyyy').toUpperCase()} ***</span>
5360
</div>
5461

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>
5764
<div class="flex flex-col items-center gap-1 w-10 shrink-0 mt-4">
5865
<div class="w-8 h-8 md:w-9 md:h-9 rounded-full overflow-hidden">
5966
<img
@@ -69,7 +76,7 @@
6976
class="flex-1 text-[0.95rem]
7077
[&_h1]:text-[1.2rem] [&_h1]:uppercase [&_h1]:font-black [&_h1]:mb-2 [&_h1]:mt-4
7178
[&_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
7380
[&_h4]:text-[0.9rem] [&_h4]:font-bold [&_h4]:mb-1 [&_h4]:mt-2
7481
[&_h5]:text-[0.8rem] [&_h5]:font-bold [&_h5]:italic [&_h5]:mb-1
7582
[&_p]:my-4 [&_img]:grayscale [&_img]:contrast-120 [&_img]:max-w-full [&_img]:my-5 [&_img]:border-2 [&_img]:border-black
@@ -95,7 +102,7 @@
95102
<p class="text-center">NO DATA.</p>
96103
{/if}
97104

98-
{#if memoList.visibleCount < data.memos.length}
105+
{#if memoList.visibleCount < memoList.filteredMemos.length}
99106
<div class="text-center my-5">
100107
<button
101108
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

Comments
 (0)