From 12e18f9810aeeec3ac7a0d8afb0fe9d9943a8b09 Mon Sep 17 00:00:00 2001 From: neil Date: Wed, 11 Jan 2023 11:50:20 +0800 Subject: [PATCH 1/2] #133 TopBar implementation * rm side navbar --- .../gui/src/components/NavBar/NavBar.svelte | 136 ------------------ .../SearchPopupResults.svelte | 4 +- .../ProfileNavButton.svelte | 0 .../gui/src/components/TopBar/TopBar.svelte | 70 +++++++++ modules/gui/src/libs/stores.ts | 3 + modules/gui/src/libs/stores/nav.ts | 10 ++ modules/gui/src/routes/+layout.svelte | 28 +--- modules/gui/src/routes/cli/+page.svelte | 4 +- .../gui/src/routes/documentation/+page.svelte | 4 +- modules/gui/src/routes/others/+page.svelte | 13 -- modules/gui/src/routes/packages/+page.svelte | 4 +- .../src/routes/packages/[slug]/+page.svelte | 5 +- modules/gui/src/routes/profile/+page.svelte | 4 +- modules/ui/src/SearchInput/SearchInput.svelte | 3 +- modules/ui/src/icons/fonts/tea-icons.eot | Bin 5480 -> 6116 bytes modules/ui/src/icons/fonts/tea-icons.svg | 7 +- modules/ui/src/icons/fonts/tea-icons.ttf | Bin 5312 -> 5948 bytes modules/ui/src/icons/fonts/tea-icons.woff | Bin 3600 -> 4140 bytes modules/ui/src/icons/icons.css | 21 ++- 19 files changed, 123 insertions(+), 193 deletions(-) delete mode 100644 modules/gui/src/components/NavBar/NavBar.svelte rename modules/gui/src/components/{NavBar => TopBar}/ProfileNavButton.svelte (100%) create mode 100644 modules/gui/src/components/TopBar/TopBar.svelte create mode 100644 modules/gui/src/libs/stores/nav.ts delete mode 100644 modules/gui/src/routes/others/+page.svelte diff --git a/modules/gui/src/components/NavBar/NavBar.svelte b/modules/gui/src/components/NavBar/NavBar.svelte deleted file mode 100644 index f818e45..0000000 --- a/modules/gui/src/components/NavBar/NavBar.svelte +++ /dev/null @@ -1,136 +0,0 @@ - - - - - diff --git a/modules/gui/src/components/SearchPopupResults/SearchPopupResults.svelte b/modules/gui/src/components/SearchPopupResults/SearchPopupResults.svelte index 2444caa..67458bd 100644 --- a/modules/gui/src/components/SearchPopupResults/SearchPopupResults.svelte +++ b/modules/gui/src/components/SearchPopupResults/SearchPopupResults.svelte @@ -123,8 +123,8 @@ diff --git a/modules/gui/src/libs/stores.ts b/modules/gui/src/libs/stores.ts index af5097f..e29fa29 100644 --- a/modules/gui/src/libs/stores.ts +++ b/modules/gui/src/libs/stores.ts @@ -6,6 +6,7 @@ import type { GUIPackage } from '$libs/types'; import { getPackages, getFeaturedPackages, getPackageReviews, getAllPosts } from '@api'; import initAuthStore from './stores/auth'; +import initNavStore from './stores/nav'; export const backLink = writable('/'); @@ -172,3 +173,5 @@ function initSearchStore() { export const searchStore = initSearchStore(); export const authStore = initAuthStore(); + +export const navStore = initNavStore(); diff --git a/modules/gui/src/libs/stores/nav.ts b/modules/gui/src/libs/stores/nav.ts new file mode 100644 index 0000000..b8d3729 --- /dev/null +++ b/modules/gui/src/libs/stores/nav.ts @@ -0,0 +1,10 @@ +import { writable } from 'svelte/store'; + +export default function initNavStore() { + const backLink = writable('/'); + + return { + backLink, + set: (newlink: string) => backLink.set(newlink) + }; +} diff --git a/modules/gui/src/routes/+layout.svelte b/modules/gui/src/routes/+layout.svelte index fa7a693..f349f5b 100644 --- a/modules/gui/src/routes/+layout.svelte +++ b/modules/gui/src/routes/+layout.svelte @@ -2,32 +2,19 @@ -
- +
+
- {#if backLink} -
- -
- {/if}
@@ -43,16 +30,11 @@