summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Carstairs <jcarstairs@scottlogic.com>2024-01-12 16:07:19 +0000
committerJoe Carstairs <jcarstairs@scottlogic.com>2024-01-12 16:07:19 +0000
commit23e63a1b391c90203f9cde8c939923a0d21ed1c3 (patch)
tree9c53a7d740c2b001e49dacaf0bc8264fef6cbf59 /src
parent2bf64117190300caac82594cb7818dbc7f67af67 (diff)
Removes navlinks from navbar
Diffstat (limited to 'src')
-rw-r--r--src/components/Navbar/Breadcrumbs.astro31
-rw-r--r--src/components/Navbar/NavLinks.astro28
-rw-r--r--src/components/Navbar/Navbar.astro8
-rw-r--r--src/i18n/translations/components/breadcrumbs.ts50
4 files changed, 1 insertions, 116 deletions
diff --git a/src/components/Navbar/Breadcrumbs.astro b/src/components/Navbar/Breadcrumbs.astro
deleted file mode 100644
index f949873..0000000
--- a/src/components/Navbar/Breadcrumbs.astro
+++ /dev/null
@@ -1,31 +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(/(?<!\/)$/, '/');
-const localeInPath = new RegExp(`/(?<=^/)(${locales.join('|')})`);
-const locale = path.match(localeInPath)?.[1] as Locale;
-if (!locale) {
- return;
-}
-const pathWithoutLocale = path.replace(new RegExp(`^/${locale}`), '');
-const slashIndices = findAllIndicesOf('/', pathWithoutLocale);
-const parentRoutes = slashIndices.map((n) => pathWithoutLocale.slice(0, n + 1)).slice(0, -1);
-
-const t = translate(locale);
----
-
-<ol class="nav__breadcrumbs">
- {
- parentRoutes.map((route) => {
- return (
- <li>
- <a href={`/${locale}${route}`}>{t(tBreadcrumbs, { key: route })}</a>
- </li>
- );
- })
- }
-</ol>
diff --git a/src/components/Navbar/NavLinks.astro b/src/components/Navbar/NavLinks.astro
deleted file mode 100644
index 798c24e..0000000
--- a/src/components/Navbar/NavLinks.astro
+++ /dev/null
@@ -1,28 +0,0 @@
----
-import { getLocaleFromPathOrDefault } 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 = getLocaleFromPathOrDefault(Astro.url.pathname);
-const t = translate(locale);
----
-
-<ul class="nav__nav-links">
- <li>
- <a class="btn" href={`/${locale}/news`}>{t(tNews, { key: 'title' })}</a>
- </li>
- <li>
- <a class="btn" href={`/${locale}/#about`}>{t(tHame, { key: 'about-us' })}</a>
- </li>
- <li>
- <a class="btn" href={`/${locale}/furthsettins`}>{t(tFurthsettins, { key: 'title' })}</a>
- </li>
- <li>
- <a class="btn" href={`/${locale}/#jyne`}>{t(tHame, { key: 'jyne' })}</a>
- </li>
- <li>
- <a class="btn" href={`/${locale}/#contact`}>{t(tHame, { key: 'contact' })}</a>
- </li>
-</ul>
diff --git a/src/components/Navbar/Navbar.astro b/src/components/Navbar/Navbar.astro
index 4fa05a9..a6f8491 100644
--- a/src/components/Navbar/Navbar.astro
+++ b/src/components/Navbar/Navbar.astro
@@ -1,15 +1,9 @@
---
-import Breadcrumbs from './Breadcrumbs.astro';
import SwitchLanguageLink from '../SwitchLanguageLink.astro';
-import NavLinks from './NavLinks.astro';
import Logo from './Logo.astro';
---
<nav class="nav">
<Logo />
- <NavLinks />
- <div class="nav__bottom-row">
- <Breadcrumbs />
- <SwitchLanguageLink />
- </div>
+ <SwitchLanguageLink />
</nav>
diff --git a/src/i18n/translations/components/breadcrumbs.ts b/src/i18n/translations/components/breadcrumbs.ts
deleted file mode 100644
index 5aeff0e..0000000
--- a/src/i18n/translations/components/breadcrumbs.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { getLallansIssue } from '$data/lallans';
-import { getScotsoun } from '$data/scotsoun';
-import type { TranslationsDictionary } from '$types/TranslationsDictionary';
-
-// This maun be kept up til date bi haund. There is
-// nae compile-time check that aw routes hae been
-// translatit.
-const tBreadcrumbs = {
- '/': {
- sco: () => 'Hame',
- 'en-GB': () => 'Home',
- },
- '/furthsettins/': {
- sco: () => 'Furthsettins',
- 'en-GB': () => 'Publications',
- },
- '/furthsettins/lallans/': {
- sco: () => 'Lallans',
- 'en-GB': () => 'Lallans',
- },
- '/furthsettins/scotsoun/': {
- sco: () => 'Scotsoun',
- 'en-GB': () => 'Scotsoun',
- },
- '/news/': {
- sco: () => 'News',
- 'en-GB': () => 'News',
- },
- ...Object.fromEntries(
- Object.keys(getLallansIssue).map((lallansIssueNumber) => [
- `/furthsettins/lallans/${lallansIssueNumber}/`,
- {
- sco: () => `Lallans ${lallansIssueNumber}`,
- 'en-GB': () => `Lallans ${lallansIssueNumber}`,
- },
- ])
- ),
- ...Object.fromEntries(
- Object.keys(getScotsoun).map((scotsounId) => [
- `/furthsettins/scotsoun/${scotsounId}/`,
- {
- sco: () => `Scotsoun ${scotsounId}`,
- 'en-GB': () => `Scotsoun ${scotsounId}`,
- },
- ])
- ),
-};
-
-type Raw = typeof tBreadcrumbs;
-export default tBreadcrumbs as TranslationsDictionary<Raw>;