From a56344ea9aced15fc4d2932d48cb2efd7f452e94 Mon Sep 17 00:00:00 2001 From: Joe Carstairs <65492573+Sycamost@users.noreply.github.com> Date: Fri, 18 Aug 2023 21:28:17 +0100 Subject: Pulls out nav module --- src/components/Breadcrumbs.astro | 33 --------------------------------- src/components/NavLinks.astro | 25 ------------------------- src/components/Navbar.astro | 24 ------------------------ src/components/Navbar/Breadcrumbs.astro | 33 +++++++++++++++++++++++++++++++++ src/components/Navbar/Logo.astro | 14 ++++++++++++++ src/components/Navbar/NavLinks.astro | 25 +++++++++++++++++++++++++ src/components/Navbar/Navbar.astro | 15 +++++++++++++++ src/components/SwitchLanguageLink.astro | 2 +- 8 files changed, 88 insertions(+), 83 deletions(-) delete mode 100644 src/components/Breadcrumbs.astro delete mode 100644 src/components/NavLinks.astro delete mode 100644 src/components/Navbar.astro create mode 100644 src/components/Navbar/Breadcrumbs.astro create mode 100644 src/components/Navbar/Logo.astro create mode 100644 src/components/Navbar/NavLinks.astro create mode 100644 src/components/Navbar/Navbar.astro (limited to 'src/components') diff --git a/src/components/Breadcrumbs.astro b/src/components/Breadcrumbs.astro deleted file mode 100644 index 66f2a66..0000000 --- a/src/components/Breadcrumbs.astro +++ /dev/null @@ -1,33 +0,0 @@ ---- -import findAllIndicesOf from '$lib/findAllIndicesOf'; -import translate from '$i18n/translate'; -import tBreadcrumbs from '$i18n/translations/components/breadcrumbs'; -import type Locale from '$types/Locale'; -import locales from '$i18n/locales'; - -const path = Astro.url.pathname.replace(/(? pathWithoutLocale.slice(0, n + 1)).slice(0, -1); - -const t = translate(locale); ---- - -
diff --git a/src/components/NavLinks.astro b/src/components/NavLinks.astro deleted file mode 100644 index a34014e..0000000 --- a/src/components/NavLinks.astro +++ /dev/null @@ -1,25 +0,0 @@ ---- -import getLocaleFromPath from '$lib/getLocaleFromPath'; -import translate from '$i18n/translate'; -import tNews from '$i18n/translations/pages/news'; -import tFurthsettins from '$i18n/translations/pages/furthsettins'; -import tHame from '$i18n/translations/pages/home'; - -const locale = getLocaleFromPath(Astro.url.pathname); -const t = translate(locale); ---- - - diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro deleted file mode 100644 index 654b085..0000000 --- a/src/components/Navbar.astro +++ /dev/null @@ -1,24 +0,0 @@ ---- -import Breadcrumbs from './Breadcrumbs.astro'; -import SwitchLanguageLink from './SwitchLanguageLink.astro'; -import tSite from '$i18n/translations/site'; -import translate from '$i18n/translate'; -import getLocaleFromPath from '$lib/getLocaleFromPath'; -import NavLinks from './NavLinks.astro'; - -const locale = getLocaleFromPath(Astro.url.pathname); -const t = translate(locale); ---- - - diff --git a/src/components/Navbar/Breadcrumbs.astro b/src/components/Navbar/Breadcrumbs.astro new file mode 100644 index 0000000..1e82fd9 --- /dev/null +++ b/src/components/Navbar/Breadcrumbs.astro @@ -0,0 +1,33 @@ +--- +import findAllIndicesOf from '$lib/findAllIndicesOf'; +import translate from '$i18n/translate'; +import tBreadcrumbs from '$i18n/translations/components/breadcrumbs'; +import type Locale from '$types/Locale'; +import locales from '$i18n/locales'; + +const path = Astro.url.pathname.replace(/(? pathWithoutLocale.slice(0, n + 1)).slice(0, -1); + +const t = translate(locale); +--- + + diff --git a/src/components/Navbar/Logo.astro b/src/components/Navbar/Logo.astro new file mode 100644 index 0000000..58bf01d --- /dev/null +++ b/src/components/Navbar/Logo.astro @@ -0,0 +1,14 @@ +--- +import translate from '$i18n/translate'; +import getLocaleFromPath from '$lib/getLocaleFromPath'; +import tSite from '$i18n/translations/site'; + +const locale = getLocaleFromPath(Astro.url.pathname); +const t = translate(locale); +--- + + diff --git a/src/components/Navbar/NavLinks.astro b/src/components/Navbar/NavLinks.astro new file mode 100644 index 0000000..a34014e --- /dev/null +++ b/src/components/Navbar/NavLinks.astro @@ -0,0 +1,25 @@ +--- +import getLocaleFromPath from '$lib/getLocaleFromPath'; +import translate from '$i18n/translate'; +import tNews from '$i18n/translations/pages/news'; +import tFurthsettins from '$i18n/translations/pages/furthsettins'; +import tHame from '$i18n/translations/pages/home'; + +const locale = getLocaleFromPath(Astro.url.pathname); +const t = translate(locale); +--- + + diff --git a/src/components/Navbar/Navbar.astro b/src/components/Navbar/Navbar.astro new file mode 100644 index 0000000..aea8909 --- /dev/null +++ b/src/components/Navbar/Navbar.astro @@ -0,0 +1,15 @@ +--- +import Breadcrumbs from './Breadcrumbs.astro'; +import SwitchLanguageLink from '../SwitchLanguageLink.astro'; +import NavLinks from './NavLinks.astro'; +import Logo from './Logo.astro'; +--- + + diff --git a/src/components/SwitchLanguageLink.astro b/src/components/SwitchLanguageLink.astro index e7b04da..d3e5ab9 100644 --- a/src/components/SwitchLanguageLink.astro +++ b/src/components/SwitchLanguageLink.astro @@ -20,7 +20,7 @@ const otherLocalePath = currentPath const t = translate(otherLocale); --- - + { t(tPage, { key: 'language-link-text', -- cgit v1.2.3