summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2023-08-18 21:28:17 +0100
committerJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2023-08-18 21:38:16 +0100
commita56344ea9aced15fc4d2932d48cb2efd7f452e94 (patch)
tree12e58f6a0699291d4c5aea5c36d251db845f895b /src/components
parent57b86c33a183e11652215f8588f728476f176fc5 (diff)
Pulls out nav module
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Navbar.astro24
-rw-r--r--src/components/Navbar/Breadcrumbs.astro (renamed from src/components/Breadcrumbs.astro)2
-rw-r--r--src/components/Navbar/Logo.astro14
-rw-r--r--src/components/Navbar/NavLinks.astro (renamed from src/components/NavLinks.astro)0
-rw-r--r--src/components/Navbar/Navbar.astro15
-rw-r--r--src/components/SwitchLanguageLink.astro2
6 files changed, 31 insertions, 26 deletions
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);
----
-
-<nav>
- <p class="title--small nav__logo">
- <a href="/">
- {t(tSite, { key: 'scots-leid-associe' })}
- </a>
- </p>
- <NavLinks />
- <div class="nav__bottom-row">
- <SwitchLanguageLink />
- <Breadcrumbs />
- </div>
-</nav>
diff --git a/src/components/Breadcrumbs.astro b/src/components/Navbar/Breadcrumbs.astro
index 66f2a66..1e82fd9 100644
--- a/src/components/Breadcrumbs.astro
+++ b/src/components/Navbar/Breadcrumbs.astro
@@ -18,7 +18,7 @@ const parentRoutes = slashIndices.map((n) => pathWithoutLocale.slice(0, n + 1)).
const t = translate(locale);
---
-<ol class="breadcrumbs">
+<ol class="nav__breadcrumbs">
{
parentRoutes.map((route) => {
return (
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);
+---
+
+<p class="title--small nav__logo">
+ <a href="/">
+ {t(tSite, { key: 'scots-leid-associe' })}
+ </a>
+</p>
diff --git a/src/components/NavLinks.astro b/src/components/Navbar/NavLinks.astro
index a34014e..a34014e 100644
--- a/src/components/NavLinks.astro
+++ b/src/components/Navbar/NavLinks.astro
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';
+---
+
+<nav>
+ <Logo />
+ <NavLinks />
+ <div class="nav__bottom-row">
+ <SwitchLanguageLink />
+ <Breadcrumbs />
+ </div>
+</nav>
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);
---
-<a class="link switch-language-link" href={otherLocalePath}>
+<a class="link nav__switch-language-link" href={otherLocalePath}>
{
t(tPage, {
key: 'language-link-text',