From 05e3adb5bbb5ebc7f358a960a26a6ac6f985eae0 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Sun, 28 Apr 2024 00:27:17 +0100 Subject: [PATCH] Add announcements banner loading content Add leaflet type definitions --- front/package-lock.json | 16 +++++ front/package.json | 1 + .../src/components/AnnouncementBanner.svelte | 65 ++++++++++++++++++ front/src/lib/test-api.js | 8 +++ front/src/pages/PageIndex.svelte | 66 ++++++++++++++----- front/src/pages/PageMenu.svelte | 6 +- front/src/styles/_announcement_banner.scss | 11 ++-- 7 files changed, 149 insertions(+), 24 deletions(-) create mode 100644 front/src/components/AnnouncementBanner.svelte diff --git a/front/package-lock.json b/front/package-lock.json index 50e1608..2abbd70 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -13,6 +13,7 @@ }, "devDependencies": { "@sveltejs/vite-plugin-svelte": "^3.0.2", + "@types/leaflet": "^1.9.12", "phosphor-svelte": "^2.0.1", "sass": "^1.75.0", "svelte": "^4.2.12", @@ -701,6 +702,21 @@ "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, + "node_modules/@types/geojson": { + "version": "7946.0.14", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", + "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==", + "dev": true + }, + "node_modules/@types/leaflet": { + "version": "1.9.12", + "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.12.tgz", + "integrity": "sha512-BK7XS+NyRI291HIo0HCfE18Lp8oA30H1gpi1tf0mF3TgiCEzanQjOqNZ4x126SXzzi2oNSZhZ5axJp1k0iM6jg==", + "dev": true, + "dependencies": { + "@types/geojson": "*" + } + }, "node_modules/acorn": { "version": "8.11.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", diff --git a/front/package.json b/front/package.json index b65de51..c229f4a 100644 --- a/front/package.json +++ b/front/package.json @@ -10,6 +10,7 @@ }, "devDependencies": { "@sveltejs/vite-plugin-svelte": "^3.0.2", + "@types/leaflet": "^1.9.12", "phosphor-svelte": "^2.0.1", "sass": "^1.75.0", "svelte": "^4.2.12", diff --git a/front/src/components/AnnouncementBanner.svelte b/front/src/components/AnnouncementBanner.svelte new file mode 100644 index 0000000..0433e88 --- /dev/null +++ b/front/src/components/AnnouncementBanner.svelte @@ -0,0 +1,65 @@ + + + +{#await announcement} +
+
+
+{:then announcement} +
+ +
+{:catch error} +

{error}

+{/await} + + \ No newline at end of file diff --git a/front/src/lib/test-api.js b/front/src/lib/test-api.js index 91f43fa..40e0d55 100644 --- a/front/src/lib/test-api.js +++ b/front/src/lib/test-api.js @@ -4,6 +4,14 @@ async function fakeDelay(timeout = 1000) { await new Promise(resolve => setTimeout(resolve, timeout)); } +export async function getAnnouncements() { + const data = { + image: "/BannerExampleImage.jpg", + }; + await fakeDelay(2000) + return data; +} + export async function getPopularToday() { const data = Items; await fakeDelay(2000) diff --git a/front/src/pages/PageIndex.svelte b/front/src/pages/PageIndex.svelte index 64b26f1..fd855de 100644 --- a/front/src/pages/PageIndex.svelte +++ b/front/src/pages/PageIndex.svelte @@ -1,22 +1,23 @@ @@ -25,9 +26,7 @@ -
- -
+ Learn More
@@ -49,18 +48,21 @@ Sunday11am2am
+ Ready to book a table?

Popular Today

-{#await items} -

Loading...

-{:then items} - -{:catch error} -

{error}

-{/await} + See All
@@ -114,6 +116,30 @@ h2, p { padding-bottom: $spacing-xsmall; } + + a { + margin-top: 8px; + padding: 0 $spacing-small; + + width: 100%; + height: 30px; + + display: flex; + justify-content: center; + align-items: center; + + font-size: $font-size-p; + text-decoration: none; + + border-radius: 9999px; + background-color: $color-primary; + color: $color-on-primary; + + &:hover { + background-color: $color-dark; + color: $color-on-dark; + } + } } } @@ -154,6 +180,10 @@ } } + #popular { + position: relative; + } + @media only screen and (max-width: 900px) { #map { min-width: 400px; diff --git a/front/src/pages/PageMenu.svelte b/front/src/pages/PageMenu.svelte index 59d3803..5598a04 100644 --- a/front/src/pages/PageMenu.svelte +++ b/front/src/pages/PageMenu.svelte @@ -7,13 +7,17 @@ import { getMenuItems } from "%/lib/test-api.js"; let items = getMenuItems(); + + function reloadMenu() { + items = getMenuItems(); + }