diff --git a/src/lib/components/dialog/DefaultDialog.svelte b/src/lib/components/dialog/DefaultDialog.svelte new file mode 100644 index 0000000..262cc03 --- /dev/null +++ b/src/lib/components/dialog/DefaultDialog.svelte @@ -0,0 +1,67 @@ + + + { + boredState.update((n) => ({ ...n, dialog: { ...n.dialog, isOpen: false } })); + }} + static +> +
+ +
+ Default Dialog + Dialog Description + + +
+
+ + diff --git a/src/lib/components/dialog/RemoveCollectionDialog.svelte b/src/lib/components/dialog/RemoveCollectionDialog.svelte new file mode 100644 index 0000000..4045308 --- /dev/null +++ b/src/lib/components/dialog/RemoveCollectionDialog.svelte @@ -0,0 +1,82 @@ + + + { + boredState.update((n) => ({ ...n, dialog: { isOpen: false } })); + }} + static +> +
+ +
+ Remove from collection + Are you sure you want to remove from your collection? + + +
+
+
+ + diff --git a/src/lib/components/game/index.svelte b/src/lib/components/game/index.svelte index 3bd90b1..4ee00f8 100644 --- a/src/lib/components/game/index.svelte +++ b/src/lib/components/game/index.svelte @@ -73,12 +73,9 @@ background-color: var(--color-btn-primary-active); } - /* :global(.icon) { - width: 24px; - height: 24px; - } */ - .game-container { + /* display: grid; */ + /* grid-template-rows: minmax(25px, 50px) 1fr minmax(50px, 75px); */ display: flex; flex-wrap: wrap; @@ -107,5 +104,9 @@ padding: 0.25rem; } } + + .btn { + max-height: 50px; + } } diff --git a/src/lib/stores/boredState.ts b/src/lib/stores/boredState.ts index 78f10d3..5824923 100644 --- a/src/lib/stores/boredState.ts +++ b/src/lib/stores/boredState.ts @@ -1,26 +1,19 @@ -import type { BoredStore } from '$lib/types'; +import type { BoredStore, Dialog } from '$lib/types'; import { writable } from 'svelte/store'; +import DefaultDialog from '../components/dialog/DefaultDialog.svelte'; // import { BoredStore } from '$lib/types'; // Custom store const state = () => { - const { subscribe, set, update } = writable({ loading: false }); - - // function remove(id: string) { - // update((store) => { - // const newStore = store.filter((item: GameType) => item.id !== id); - // return [...newStore]; - // }); - // } - - // function removeAll() { - // update(() => { - // return []; - // }); - // } + const initialDialog: Dialog = { + isOpen: false, + content: DefaultDialog + } + const initial = { loading: false, dialog: initialDialog } + const { subscribe, set, update } = writable(initial); function clear() { - set({ loading: false }); + set(initial); } return { subscribe, set, update, clear }; diff --git a/src/lib/types.ts b/src/lib/types.ts index 6944ee8..a4d83dc 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -1,5 +1,14 @@ +import type { SvelteComponent } from "svelte"; + +export type Dialog = { + isOpen: boolean; + content?: typeof SvelteComponent; + additionalData?: SavedGameType | GameType; +} + export type BoredStore = { loading: boolean; + dialog: Dialog; }; export enum ToastType { diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index d894f0b..2c5e64f 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,6 +1,7 @@ - Bored Game + Bored Game | Home

Search Boardgames!

@@ -76,28 +67,6 @@ {/if} -{#if isOpen} -
-
- (isOpen = false)} static> -
- -
- Remove from collection - Are you sure you want to remove from your collection? - - -
-
-
-
-
-{/if} diff --git a/src/routes/collection/+page.svelte b/src/routes/collection/+page.svelte index 113cd0e..d6d410e 100644 --- a/src/routes/collection/+page.svelte +++ b/src/routes/collection/+page.svelte @@ -1,15 +1,10 @@ @@ -48,28 +41,6 @@ {/if} -{#if isOpen} -
-
- (isOpen = false)} static> -
- -
- Remove from collection - Are you sure you want to remove from your collection? - - -
-
-
-
-
-{/if} diff --git a/src/routes/game/[id]/+page.svelte b/src/routes/game/[id]/+page.svelte index 4b6f338..eb41f3b 100644 --- a/src/routes/game/[id]/+page.svelte +++ b/src/routes/game/[id]/+page.svelte @@ -1,8 +1,4 @@ @@ -59,7 +65,7 @@ >Board Game Atlas Link {#if existsInCollection} - {:else} @@ -141,4 +147,9 @@ gap: 1.5rem; margin: 1rem; } + + .with-icon { + display: flex; + place-items: center; + }