mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Using next version of kit, remove media query store and implementing myself with their code, and using small screen breakpoint.
This commit is contained in:
parent
9dbaa927e3
commit
ac71e23c94
5 changed files with 320 additions and 916 deletions
|
|
@ -16,8 +16,8 @@
|
||||||
"@playwright/test": "^1.27.1",
|
"@playwright/test": "^1.27.1",
|
||||||
"@rgossiaux/svelte-headlessui": "1.0.2",
|
"@rgossiaux/svelte-headlessui": "1.0.2",
|
||||||
"@rgossiaux/svelte-heroicons": "^0.1.2",
|
"@rgossiaux/svelte-heroicons": "^0.1.2",
|
||||||
"@sveltejs/adapter-auto": "1.0.0-next.72",
|
"@sveltejs/adapter-auto": "next",
|
||||||
"@sveltejs/kit": "1.0.0-next.480",
|
"@sveltejs/kit": "next",
|
||||||
"@types/cookie": "^0.5.1",
|
"@types/cookie": "^0.5.1",
|
||||||
"@types/node": "^18.11.9",
|
"@types/node": "^18.11.9",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
||||||
|
|
@ -46,7 +46,6 @@
|
||||||
"cookie": "^0.5.0",
|
"cookie": "^0.5.0",
|
||||||
"feather-icons": "^4.29.0",
|
"feather-icons": "^4.29.0",
|
||||||
"svelte-lazy-loader": "^1.0.0",
|
"svelte-lazy-loader": "^1.0.0",
|
||||||
"svelte-media-query-store": "^1.0.0",
|
|
||||||
"zod": "^3.19.1",
|
"zod": "^3.19.1",
|
||||||
"zod-to-json-schema": "^3.18.1"
|
"zod-to-json-schema": "^3.18.1"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1189
pnpm-lock.yaml
1189
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
2
src/app.d.ts
vendored
2
src/app.d.ts
vendored
|
|
@ -8,7 +8,7 @@ declare namespace App {
|
||||||
|
|
||||||
// interface PageData {}
|
// interface PageData {}
|
||||||
|
|
||||||
// interface PageError {}
|
// interface Error {}
|
||||||
|
|
||||||
// interface Platform {}
|
// interface Platform {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tick } from 'svelte';
|
import { tick } from 'svelte';
|
||||||
import type { ActionData, PageData } from './$types';
|
import type { ActionData, PageData } from './$types';
|
||||||
|
import { applyAction, enhance } from '$app/forms';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import { Disclosure, DisclosureButton, DisclosurePanel } from '@rgossiaux/svelte-headlessui';
|
import { Disclosure, DisclosureButton, DisclosurePanel } from '@rgossiaux/svelte-headlessui';
|
||||||
import { ChevronRightIcon } from '@rgossiaux/svelte-heroicons/solid';
|
import { ChevronRightIcon } from '@rgossiaux/svelte-heroicons/solid';
|
||||||
import { xl, md } from '$lib/stores/mediaQueryStore';
|
|
||||||
import { boredState } from '$lib/stores/boredState';
|
import { boredState } from '$lib/stores/boredState';
|
||||||
import AdvancedSearch from '$lib/components/search/advancedSearch/index.svelte';
|
import AdvancedSearch from '$lib/components/search/advancedSearch/index.svelte';
|
||||||
import { applyAction, enhance } from '$app/forms';
|
import { xl, md, sm } from '$lib/stores/mediaQueryStore';
|
||||||
import { gameStore } from '$root/lib/stores/gameSearchStore';
|
import { gameStore } from '$root/lib/stores/gameSearchStore';
|
||||||
import { toast } from '../../toast/toast';
|
import { toast } from '../../toast/toast';
|
||||||
import Pagination from '$lib/components/pagination/index.svelte';
|
import Pagination from '$lib/components/pagination/index.svelte';
|
||||||
|
|
@ -44,10 +44,16 @@
|
||||||
$: showPagination = $gameStore?.length > 1;
|
$: showPagination = $gameStore?.length > 1;
|
||||||
|
|
||||||
if ($xl) {
|
if ($xl) {
|
||||||
|
console.log('Was xl');
|
||||||
numberOfGameSkeleton = 8;
|
numberOfGameSkeleton = 8;
|
||||||
} else if ($md) {
|
} else if ($md) {
|
||||||
|
console.log('Was md');
|
||||||
numberOfGameSkeleton = 3;
|
numberOfGameSkeleton = 3;
|
||||||
|
} else if ($sm) {
|
||||||
|
console.log('Was sm');
|
||||||
|
numberOfGameSkeleton = 2;
|
||||||
} else {
|
} else {
|
||||||
|
console.log('Was none');
|
||||||
numberOfGameSkeleton = 1;
|
numberOfGameSkeleton = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,32 @@
|
||||||
import { mediaQueryStore } from 'svelte-media-query-store';
|
import { readable } from 'svelte/store';
|
||||||
|
|
||||||
|
export function mediaQueryStore(query: string) {
|
||||||
|
if (typeof window === 'undefined') {
|
||||||
|
// check if it's rendered in the dom so window is not undefined
|
||||||
|
return readable('');
|
||||||
|
}
|
||||||
|
const mediaQueryList = window.matchMedia(query);
|
||||||
|
|
||||||
|
const mediaStore = readable(mediaQueryList.matches, (set) => {
|
||||||
|
const handleChange = () => set(mediaQueryList.matches);
|
||||||
|
|
||||||
|
try {
|
||||||
|
mediaQueryList.addEventListener('change', handleChange);
|
||||||
|
} catch (_) {
|
||||||
|
mediaQueryList.addListener(handleChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
try {
|
||||||
|
mediaQueryList.removeEventListener('change', handleChange);
|
||||||
|
} catch (_) {
|
||||||
|
mediaQueryList.removeListener(handleChange);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return mediaStore;
|
||||||
|
}
|
||||||
|
|
||||||
export const xs = mediaQueryStore('(min-width: 480px');
|
export const xs = mediaQueryStore('(min-width: 480px');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue