mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2025-05-14 07:32:16 +00:00
Add availability to item, and banner if item is no-longer for purchase
SCSS fixes, file paths and font sizing Larger spacing for item screen
This commit is contained in:
parent
a1678ff751
commit
f6e8f4291c
6 changed files with 63 additions and 13 deletions
|
@ -3,6 +3,7 @@ import { type Item, Labels } from "./types";
|
||||||
const TestData: Item[] = [
|
const TestData: Item[] = [
|
||||||
{
|
{
|
||||||
uuid: "soap",
|
uuid: "soap",
|
||||||
|
availability: true,
|
||||||
name: "Bar of Soap",
|
name: "Bar of Soap",
|
||||||
price: 69.99,
|
price: 69.99,
|
||||||
description: `
|
description: `
|
||||||
|
@ -12,6 +13,7 @@ Example
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
uuid: "sock",
|
uuid: "sock",
|
||||||
|
availability: true,
|
||||||
name: "Sock",
|
name: "Sock",
|
||||||
price: 21,
|
price: 21,
|
||||||
description: `
|
description: `
|
||||||
|
@ -21,6 +23,7 @@ Example
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
uuid: "brick",
|
uuid: "brick",
|
||||||
|
availability: true,
|
||||||
name: "Brick",
|
name: "Brick",
|
||||||
price: 0,
|
price: 0,
|
||||||
description: `
|
description: `
|
||||||
|
@ -30,6 +33,7 @@ Example
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
uuid: "toast",
|
uuid: "toast",
|
||||||
|
availability: true,
|
||||||
name: "Toast",
|
name: "Toast",
|
||||||
price: 4382749832743,
|
price: 4382749832743,
|
||||||
description: `
|
description: `
|
||||||
|
@ -39,6 +43,7 @@ Example
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
uuid: "water",
|
uuid: "water",
|
||||||
|
availability: true,
|
||||||
name: "water",
|
name: "water",
|
||||||
price: 1,
|
price: 1,
|
||||||
description: `
|
description: `
|
||||||
|
@ -48,6 +53,7 @@ Example
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
uuid: "mouldy_bread",
|
uuid: "mouldy_bread",
|
||||||
|
availability: true,
|
||||||
name: "half eaten mouldy bread",
|
name: "half eaten mouldy bread",
|
||||||
price: -99,
|
price: -99,
|
||||||
description: `
|
description: `
|
||||||
|
@ -57,6 +63,7 @@ Example
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
uuid: "gwagwa",
|
uuid: "gwagwa",
|
||||||
|
availability: false,
|
||||||
name: "GwaGwa",
|
name: "GwaGwa",
|
||||||
price: 69,
|
price: 69,
|
||||||
labels: [Labels.nut],
|
labels: [Labels.nut],
|
||||||
|
@ -64,6 +71,7 @@ Example
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
uuid: "hogmelon",
|
uuid: "hogmelon",
|
||||||
|
availability: true,
|
||||||
name: "Hogermellon",
|
name: "Hogermellon",
|
||||||
price: 1111,
|
price: 1111,
|
||||||
description: `
|
description: `
|
||||||
|
@ -78,6 +86,7 @@ Contains the following:
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
uuid: "bluhog",
|
uuid: "bluhog",
|
||||||
|
availability: true,
|
||||||
name: "Blue HOGGGGG",
|
name: "Blue HOGGGGG",
|
||||||
price: 0,
|
price: 0,
|
||||||
description: `
|
description: `
|
||||||
|
|
|
@ -8,6 +8,7 @@ export enum Labels {
|
||||||
|
|
||||||
export interface Item {
|
export interface Item {
|
||||||
uuid: string;
|
uuid: string;
|
||||||
|
availability: boolean;
|
||||||
name: string;
|
name: string;
|
||||||
price: number;
|
price: number;
|
||||||
labels: Labels[];
|
labels: Labels[];
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!--<button on:click={() => { localStorage['basket'] = "balls" }}>Fuck up the cart</button>-->
|
|
||||||
|
|
||||||
{#await cartLoaded}
|
{#await cartLoaded}
|
||||||
<div id="emptyCart">
|
<div id="emptyCart">
|
||||||
<h1>Cart Loading <Basket weight="fill" /></h1>
|
<h1>Cart Loading <Basket weight="fill" /></h1>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { link } from 'svelte-spa-router';
|
import { link } from 'svelte-spa-router';
|
||||||
import { Acorn, Fish, GrainsSlash, Leaf, Minus, Pepper, Plus, SmileySad, ShoppingCart } from "phosphor-svelte";
|
import { Acorn, Fish, GrainsSlash, Leaf, Minus, Pepper, Plus, SmileySad, ShoppingCart, SealWarning } from "phosphor-svelte";
|
||||||
import SvelteMarkdown from 'svelte-markdown'
|
import SvelteMarkdown from 'svelte-markdown'
|
||||||
|
|
||||||
import { Labels } from "../lib/types";
|
import { Labels } from "../lib/types";
|
||||||
|
@ -38,6 +38,14 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#await item then item}
|
||||||
|
{#if !item.availability}
|
||||||
|
<div class="notice error">
|
||||||
|
<SealWarning weight="fill" /> <span>Item is no-longer for sale</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/await}
|
||||||
|
|
||||||
<div class="main">
|
<div class="main">
|
||||||
{#await item}
|
{#await item}
|
||||||
<div id="images">
|
<div id="images">
|
||||||
|
@ -60,7 +68,7 @@
|
||||||
</div>
|
</div>
|
||||||
{:then item}
|
{:then item}
|
||||||
<div id="images">
|
<div id="images">
|
||||||
<div class="img-main">
|
<div class="img-main loaded">
|
||||||
{#if item.images && item.images[selectedImage]}
|
{#if item.images && item.images[selectedImage]}
|
||||||
<img src="{item.images[selectedImage]}" alt="Item">
|
<img src="{item.images[selectedImage]}" alt="Item">
|
||||||
{:else}
|
{:else}
|
||||||
|
@ -79,11 +87,12 @@
|
||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="info">
|
<div id="info">
|
||||||
<h2>{item.name}</h2>
|
<h2>{item.name}</h2>
|
||||||
<p>£{item.price}</p>
|
<p>£{item.price}</p>
|
||||||
|
|
||||||
|
<div class="spacer" />
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="description">
|
<div id="description">
|
||||||
{#if item.description}
|
{#if item.description}
|
||||||
|
@ -98,6 +107,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="spacer half" />
|
||||||
|
|
||||||
<ul id="allergy-labels">
|
<ul id="allergy-labels">
|
||||||
{#each item.labels as label}
|
{#each item.labels as label}
|
||||||
{#if label === Labels.vegan}
|
{#if label === Labels.vegan}
|
||||||
|
@ -114,6 +125,8 @@
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="spacer" />
|
||||||
|
|
||||||
<div id="basket-controls">
|
<div id="basket-controls">
|
||||||
<button class="button" class:disabled={basketAmount <= 1} on:click={reduce}><Minus /></button>
|
<button class="button" class:disabled={basketAmount <= 1} on:click={reduce}><Minus /></button>
|
||||||
<p>{basketAmount}</p>
|
<p>{basketAmount}</p>
|
||||||
|
@ -154,6 +167,30 @@
|
||||||
|
|
||||||
$padding: 1px;
|
$padding: 1px;
|
||||||
|
|
||||||
|
.notice {
|
||||||
|
margin-right: auto;
|
||||||
|
margin-bottom: $spacing-large;
|
||||||
|
margin-left: auto;
|
||||||
|
|
||||||
|
max-width: $sizing-default-width;
|
||||||
|
height: 45px;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
font-size: $font-size-h6;
|
||||||
|
|
||||||
|
border-radius: $border-radius-normal;
|
||||||
|
background: $color-dark;
|
||||||
|
color: $color-on-dark;
|
||||||
|
|
||||||
|
&.error {
|
||||||
|
background: $color-error;
|
||||||
|
color: $color-on-error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -176,6 +213,12 @@
|
||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
&.loaded {
|
||||||
|
border-radius: $border-radius-large;
|
||||||
|
border: 1px solid rgba($color-dark, 0.15);
|
||||||
|
background-color: rgba($color-dark, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
> .loading.image {
|
> .loading.image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -184,8 +227,6 @@
|
||||||
> img {
|
> img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
|
|
||||||
border-radius: $border-radius-normal;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,18 +286,15 @@
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
|
|
||||||
> h2 {
|
> h2 {
|
||||||
margin-bottom: $spacing-small;
|
padding-bottom: $spacing-xsmall;
|
||||||
padding: 0;
|
|
||||||
font-size: $font-size-h1;
|
font-size: $font-size-h1;
|
||||||
}
|
}
|
||||||
> p {
|
> p {
|
||||||
margin-bottom: $spacing-normal;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: $font-size-h2;
|
font-size: $font-size-h2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
margin-bottom: $spacing-small;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
#description {
|
#description {
|
||||||
|
@ -400,7 +438,7 @@
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
> li {
|
> li {
|
||||||
margin: 0 0 $spacing-small $spacing-xsmall;
|
margin: 0 0 0 $spacing-xsmall;
|
||||||
padding: 0 $spacing-small;
|
padding: 0 $spacing-small;
|
||||||
|
|
||||||
min-width: 30px;
|
min-width: 30px;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.container {
|
.container {
|
||||||
border-radius: $border-radius-normal;
|
border-radius: $border-radius-normal;
|
||||||
background-image: url("/BackgroundTextureAlt.svg");
|
background-image: url("/assets/BackgroundTextureAlt.svg");
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: 200px 250px;
|
background-size: 200px 250px;
|
||||||
background-position: 5px -43px;
|
background-position: 5px -43px;
|
||||||
|
|
|
@ -86,10 +86,14 @@ hr {
|
||||||
|
|
||||||
button {
|
button {
|
||||||
font-family: $font-family;
|
font-family: $font-family;
|
||||||
|
font-size: $font-size-small;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spacer {
|
.spacer {
|
||||||
height: $spacing-large;
|
height: $spacing-large;
|
||||||
|
&.half {
|
||||||
|
height: calc($spacing-large / 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
Loading…
Add table
Reference in a new issue