Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/Header.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script>
import { page } from '$app/stores';
import { page } from '$app/state';
import Icons from '$components/Icons.svelte';
import { cartQuantity } from '../store';
import SearchBar from '$components/SearchBar.svelte';

let currentRoute = $derived($page.url.pathname);
let currentRoute = $derived(page.url.pathname);

let showMenu = $state(false);

Expand Down
4 changes: 2 additions & 2 deletions src/components/SearchBar.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script>
import { page } from '$app/stores';
import { page } from '$app/state';
import { goto } from '$app/navigation';
import Icons from './Icons.svelte';

let value = $page.url.searchParams.get('q') || '';
let value = page.url.searchParams.get('q') || '';

async function submit(e) {
e.preventDefault();
Expand Down
4 changes: 2 additions & 2 deletions src/routes/product/+error.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { page } from '$app/stores';
import { page } from '$app/state';
</script>

<h1>{$page.status} : {$page.error.message}</h1>
<h1>{page.status} : {page.error.message}</h1>
8 changes: 4 additions & 4 deletions src/routes/search/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { page } from '$app/stores';
import { page } from '$app/state';

/** @type {import('svelte').Snippet} */
const { children } = $props();
Expand All @@ -15,7 +15,7 @@
data-testid="category-link"
class="whitespace-nowrap hover:underline focus:underline"
href="/search"
aria-current={$page.url.pathname === '/search' ? 'page' : undefined}
aria-current={page.url.pathname === '/search' ? 'page' : undefined}
>All</a
>
</li>
Expand All @@ -25,7 +25,7 @@
data-testid="category-link"
class="whitespace-nowrap hover:underline focus:underline"
href="/search/featured"
aria-current={$page.url.pathname === '/search/featured' ? 'page' : undefined}
aria-current={page.url.pathname === '/search/featured' ? 'page' : undefined}
>Featured</a
>
</li>
Expand All @@ -35,7 +35,7 @@
data-testid="category-link"
class="whitespace-nowrap hover:underline focus:underline"
href="/search/clothes"
aria-current={$page.url.pathname === '/search/clothes' ? 'page' : undefined}
aria-current={page.url.pathname === '/search/clothes' ? 'page' : undefined}
>Apparel</a
>
</li>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/search/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script>
import GridTile from '$components/GridTile.svelte';
import { page } from '$app/stores';
import { page } from '$app/state';


/** @type {{data: import('./$types').PageData}} */
let { data } = $props();
let search = $derived($page.url.searchParams.get('q'));
let search = $derived(page.url.searchParams.get('q'));

let displayedProducts = $derived(search
? data.body.allProducts.edges.filter((item) => {
Expand Down
4 changes: 2 additions & 2 deletions src/routes/search/[collection]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script>
import GridTile from '$components/GridTile.svelte';
import { page } from '$app/stores';
import { page } from '$app/state';

/** @type {{data: import('./$types').PageData}} */
let { data } = $props();
let collection = $derived.by(() => {
for (const d of data.body.collections) {
if (d.node.handle === $page?.params?.collection) {
if (d.node.handle === page?.params?.collection) {
return d.node;
}
}
Expand Down