diff options
| author | Joe Carstairs <jcarstairs@scottlogic.com> | 2024-01-12 16:07:19 +0000 |
|---|---|---|
| committer | Joe Carstairs <jcarstairs@scottlogic.com> | 2024-01-12 16:07:19 +0000 |
| commit | 23e63a1b391c90203f9cde8c939923a0d21ed1c3 (patch) | |
| tree | 9c53a7d740c2b001e49dacaf0bc8264fef6cbf59 | |
| parent | 2bf64117190300caac82594cb7818dbc7f67af67 (diff) | |
Removes navlinks from navbar
| -rw-r--r-- | scss/index.lg.scss | 2 | ||||
| -rw-r--r-- | scss/modules/index.lg.scss | 2 | ||||
| -rw-r--r-- | scss/modules/index.md.scss | 2 | ||||
| -rw-r--r-- | scss/modules/nav.lg.scss | 15 | ||||
| -rw-r--r-- | scss/modules/nav.md.scss | 11 | ||||
| -rw-r--r-- | scss/modules/nav.scss | 42 | ||||
| -rw-r--r-- | src/components/Navbar/Breadcrumbs.astro | 31 | ||||
| -rw-r--r-- | src/components/Navbar/NavLinks.astro | 28 | ||||
| -rw-r--r-- | src/components/Navbar/Navbar.astro | 8 | ||||
| -rw-r--r-- | src/i18n/translations/components/breadcrumbs.ts | 50 |
10 files changed, 3 insertions, 188 deletions
diff --git a/scss/index.lg.scss b/scss/index.lg.scss index 4060f14..2f83ae9 100644 --- a/scss/index.lg.scss +++ b/scss/index.lg.scss @@ -1,3 +1 @@ -@use 'modules/index.lg' as *; @use 'variables/index.lg' as *; - diff --git a/scss/modules/index.lg.scss b/scss/modules/index.lg.scss deleted file mode 100644 index 56a6dd8..0000000 --- a/scss/modules/index.lg.scss +++ /dev/null @@ -1,2 +0,0 @@ -@use 'nav.lg' as *; - diff --git a/scss/modules/index.md.scss b/scss/modules/index.md.scss index b426b71..c7b06be 100644 --- a/scss/modules/index.md.scss +++ b/scss/modules/index.md.scss @@ -1,4 +1,2 @@ @use 'committee.md' as *; -@use 'nav.md' as *; @use 'schedule.md' as *; - diff --git a/scss/modules/nav.lg.scss b/scss/modules/nav.lg.scss deleted file mode 100644 index c47a685..0000000 --- a/scss/modules/nav.lg.scss +++ /dev/null @@ -1,15 +0,0 @@ -.nav__bottom-row { - flex-direction: row; - justify-content: space-between; - align-items: baseline; - padding-inline: max(10%, calc((100% - var(--max-width-all-content)) / 2)); - gap: var(--spacing-inline-xs); -} - -.nav__nav-links li:nth-child(4) { - grid-column: 8 / 10; -} - -.nav__nav-links li:nth-child(5) { - grid-column: 10 / 12; -} diff --git a/scss/modules/nav.md.scss b/scss/modules/nav.md.scss deleted file mode 100644 index c3f4a18..0000000 --- a/scss/modules/nav.md.scss +++ /dev/null @@ -1,11 +0,0 @@ -.nav__nav-links li:nth-child(3) { - grid-column: 5 / 8; -} - -.nav__nav-links li:nth-child(4) { - grid-column: 1 / 3; -} - -.nav__nav-links li:nth-child(5) { - grid-column: 3 / 5; -}
\ No newline at end of file diff --git a/scss/modules/nav.scss b/scss/modules/nav.scss index 765c44f..c4c1128 100644 --- a/scss/modules/nav.scss +++ b/scss/modules/nav.scss @@ -1,27 +1,5 @@ -.nav { - & > :not(:last-child) { - margin-block: 0 var(--margin-block-sm); - } - - li { - list-style-type: none; - } -} - -.nav__bottom-row { - display: flex; - flex-direction: column; -} - -.nav__nav-links { - display: grid; - grid-template-columns: repeat(var(--grid-column-count), var(--grid-column-width)); - column-gap: var(--grid-gutter-width); - - li { - list-style-type: none; - margin: 0; - } +.nav > :not(:last-child) { + margin-block: 0 var(--margin-block-sm); } .nav__logo { @@ -64,19 +42,3 @@ } } } - -.nav__breadcrumbs { - display: flex; - flex-wrap: wrap; - - li { - min-width: max-content; - &::before { - content: '/' - } - } -} - -.nav__switch-language-link { - text-align: right; -} 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>; |
