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/Navbar/Breadcrumbs.astro | 33 +++++++++++++++++++++++++++++++++ src/components/Navbar/Logo.astro | 14 ++++++++++++++ src/components/Navbar/NavLinks.astro | 25 +++++++++++++++++++++++++ src/components/Navbar/Navbar.astro | 15 +++++++++++++++ 4 files changed, 87 insertions(+) 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/Navbar') 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'; +--- + + -- cgit v1.2.3