From 174305ca1b05aad2b96377eb79192888ca2db77f Mon Sep 17 00:00:00 2001 From: static Date: Sat, 27 Dec 2025 23:27:57 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EC=99=80=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=EC=84=9C=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EB=AA=A9=EB=A1=9D=EC=9D=84=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=ED=95=A0=20=EB=95=8C=EB=8F=84=20=EA=B0=80=EC=83=81=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=ED=9A=A8=EC=9C=A8=EC=A0=81=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=9E=9C=EB=8D=94=EB=A7=81=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/atoms/RowVirtualizer.svelte | 46 ++++++++++ src/lib/components/atoms/index.ts | 1 + .../organisms/Category/Category.svelte | 35 ++++---- src/lib/components/organisms/Gallery.svelte | 84 ++++++++----------- .../DirectoryEntries/DirectoryEntries.svelte | 26 ++++-- 5 files changed, 121 insertions(+), 71 deletions(-) create mode 100644 src/lib/components/atoms/RowVirtualizer.svelte diff --git a/src/lib/components/atoms/RowVirtualizer.svelte b/src/lib/components/atoms/RowVirtualizer.svelte new file mode 100644 index 0000000..e821c5f --- /dev/null +++ b/src/lib/components/atoms/RowVirtualizer.svelte @@ -0,0 +1,46 @@ + + +
+
+ {#each $virtualizer.getVirtualItems() as virtualItem (virtualItem.key)} +
+ {@render item(virtualItem.index)} +
+ {/each} +
+ {#if placeholder && $virtualizer.getVirtualItems().length === 0} + {@render placeholder()} + {/if} +
diff --git a/src/lib/components/atoms/index.ts b/src/lib/components/atoms/index.ts index 14b0849..61a0238 100644 --- a/src/lib/components/atoms/index.ts +++ b/src/lib/components/atoms/index.ts @@ -3,3 +3,4 @@ export * from "./buttons"; export * from "./divs"; export * from "./inputs"; export { default as Modal } from "./Modal.svelte"; +export { default as RowVirtualizer } from "./RowVirtualizer.svelte"; diff --git a/src/lib/components/organisms/Category/Category.svelte b/src/lib/components/organisms/Category/Category.svelte index ce3abcd..0d62b25 100644 --- a/src/lib/components/organisms/Category/Category.svelte +++ b/src/lib/components/organisms/Category/Category.svelte @@ -1,7 +1,7 @@ -
-
- {#each $virtualizer.getVirtualItems() as virtualRow (virtualRow.key)} - {@const row = rows[virtualRow.index]!} -
- {#if row.type === "header"} -

{row.label}

- {:else} -
- {#each row.items as { info }} - - {/each} -
- {/if} + + rows[index]!.type === "header" + ? 32 + : Math.ceil(rows[index]!.items.length / 4) * 181 + + (Math.ceil(rows[index]!.items.length / 4) - 1) * 4 + + 16} + class="flex flex-grow flex-col" +> + {#snippet item(index)} + {@const row = rows[index]!} + {#if row.type === "header"} +

{row.label}

+ {:else} +
+ {#each row.items as { info }} + + {/each}
- {/each} -
- {#if $virtualizer.getVirtualItems().length === 0} + {/if} + {/snippet} + {#snippet placeholder()}

{#if files.length === 0} @@ -144,5 +130,5 @@ {/if}

- {/if} -
+ {/snippet} + diff --git a/src/routes/(main)/directory/[[id]]/DirectoryEntries/DirectoryEntries.svelte b/src/routes/(main)/directory/[[id]]/DirectoryEntries/DirectoryEntries.svelte index a3e975e..f7ced96 100644 --- a/src/routes/(main)/directory/[[id]]/DirectoryEntries/DirectoryEntries.svelte +++ b/src/routes/(main)/directory/[[id]]/DirectoryEntries/DirectoryEntries.svelte @@ -1,7 +1,7 @@