From cf985ab005154b4194608d188a9c645c1deeeb73 Mon Sep 17 00:00:00 2001 From: Robert Goniszewski Date: Sat, 9 Nov 2024 21:57:48 +0100 Subject: [PATCH] feat(components): add custom Select component and improve bulk list editing Signed-off-by: Robert Goniszewski --- src/lib/components/BulkList/BulkList.svelte | 19 ++-- .../BulkListItem/BulkListItem.svelte | 20 +++- .../EditBookmarkForm/EditBookmarkForm.svelte | 13 ++- src/lib/components/Select/Select.svelte | 95 +++++++++++++++++++ src/routes/import/+page.svelte | 25 +---- 5 files changed, 134 insertions(+), 38 deletions(-) create mode 100644 src/lib/components/Select/Select.svelte diff --git a/src/lib/components/BulkList/BulkList.svelte b/src/lib/components/BulkList/BulkList.svelte index 4ba2c89..0ff093e 100644 --- a/src/lib/components/BulkList/BulkList.svelte +++ b/src/lib/components/BulkList/BulkList.svelte @@ -31,16 +31,17 @@ const selectAllItems = ({ target }: Event) => { - {#each $itemList as { id, icon, url, title, category, selected, contentHtml } (id)} + {#each $itemList as item (item.id)} + id={item.id} + icon={item.icon} + url={item.url} + title={item.title} + category={item.category} + selected={item.selected} + isLoading={item.isLoading} + metadataFetched={!!item.contentHtml} + metadata={item} /> {/each} diff --git a/src/lib/components/BulkListItem/BulkListItem.svelte b/src/lib/components/BulkListItem/BulkListItem.svelte index ebc6c5c..d370d15 100644 --- a/src/lib/components/BulkListItem/BulkListItem.svelte +++ b/src/lib/components/BulkListItem/BulkListItem.svelte @@ -1,4 +1,5 @@ @@ -78,7 +92,7 @@ const removeItem = () => { {category} - - + + diff --git a/src/lib/components/EditBookmarkForm/EditBookmarkForm.svelte b/src/lib/components/EditBookmarkForm/EditBookmarkForm.svelte index 3c05057..e05981f 100644 --- a/src/lib/components/EditBookmarkForm/EditBookmarkForm.svelte +++ b/src/lib/components/EditBookmarkForm/EditBookmarkForm.svelte @@ -1,8 +1,10 @@ + + diff --git a/src/routes/import/+page.svelte b/src/routes/import/+page.svelte index c4638b1..eaefcf8 100644 --- a/src/routes/import/+page.svelte +++ b/src/routes/import/+page.svelte @@ -2,11 +2,11 @@ import { page } from '$app/stores'; import BulkList from '$lib/components/BulkList/BulkList.svelte'; import Pagination from '$lib/components/Pagination/Pagination.svelte'; +import Select from '$lib/components/Select/Select.svelte'; import { importBookmarkStore } from '$lib/stores/import-bookmarks.store'; import type { BulkListItem } from '$lib/types/common/BulkList.type'; import { importBookmarks } from '$lib/utils/import-bookmarks'; import { showToast } from '$lib/utils/show-toast'; -import Select from 'svelte-select'; import { derived, writable } from 'svelte/store'; const step = writable(1); @@ -130,23 +130,7 @@ const onSetSelectedCategory = () => {
{#if $step === 1} - -
-

WIP

-
-
- { name="category" searchable placeholder="Change category" + size="md" items={$categoriesOptions} - containerStyles="border: 1; border-color: oklch(var(--p)); max-width: 10rem; background: oklch(var(--b1) / var(--tw-bg-opacity, 1)); max-height: 32px;" - inputStyles="" - on:change={onSelectCategory} /> + onSelect={onSelectCategory} /> {/if}