Improve Item page

Add 500 page and dedicated 404 page
Add fake cache to tester API
Adjust some styles for better readability and usability
This commit is contained in:
Michał Gdula 2024-04-28 19:19:05 +01:00
parent 40c19335cf
commit 383f22bdf8
11 changed files with 297 additions and 91 deletions

View file

@ -14,20 +14,19 @@
cart: {path: '/cart', className: 'active'},
}
let windowScrollY = 0;
let windowWidth = 0;
let scrollY = 0;
let width = 0;
let oldLocation = undefined;
let fullWidth = false;
let showNavBar = false;
$: scrolled = windowScrollY > 0
$: mobile = windowWidth < 700
function routeLoading(event) {
if (event.detail.location === oldLocation) {
console.log("Fake!");
return; // not an actual change
}
showNavBar = event.detail.userData.showNavBar;
fullWidth = event.detail.userData.fullWidth;
oldLocation = event.detail.location;
@ -38,15 +37,18 @@
}
</script>
<svelte:window bind:scrollY={windowScrollY} bind:innerWidth={windowWidth} />
<svelte:window
bind:scrollY={scrollY}
bind:innerWidth={width}
/>
<svelte:head>
<link rel="stylesheet" href="https://api.fontshare.com/v2/css?f[]=erode@300,301,400,401,500,501,600,601,700,701,1,2&display=swap">
</svelte:head>
{#if showNavBar }
<nav class:scrolled={scrolled} class:mobile={mobile}>
{#if !mobile}
<nav class:scrolled={scrollY > 0} class:mobile={width < 700}>
{#if !(width < 700)}
<ul style="justify-content: flex-end">
<li use:active={links.home}><a href="/" use:link>Home</a></li>
<li use:active={links.menu}><a href="/menu" use:link>Menu</a></li>