diff --git a/src/components/About.astro b/src/components/About.astro index 0f9fc5a..2b90f5b 100644 --- a/src/components/About.astro +++ b/src/components/About.astro @@ -1,8 +1,8 @@ --- -import { translations } from '@data/i18n.js'; +import { translations, type Lang } from '@data/i18n'; import { Image } from 'astro:assets'; import benker from '@assets/studioBenker.png'; -const { lang = 'no' } = Astro.props; +const { lang = 'no' } = Astro.props as { lang?: Lang }; const t = translations[lang].about; --- diff --git a/src/components/FAQ.astro b/src/components/FAQ.astro index 5f1f0d9..906eae5 100644 --- a/src/components/FAQ.astro +++ b/src/components/FAQ.astro @@ -1,6 +1,6 @@ --- -import { translations } from '@data/i18n.js'; -const { lang = 'no' } = Astro.props; +import { translations, type Lang } from '@data/i18n'; +const { lang = 'no' } = Astro.props as { lang?: Lang }; const t = translations[lang].faq; --- diff --git a/src/components/Footer.astro b/src/components/Footer.astro index fb63986..c29d811 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -2,9 +2,9 @@ import { Image } from 'astro:assets'; import logo from '@assets/logo.png'; import DNS from '@assets/DNS-logo-hvit.png'; -import { translations } from '@data/i18n.js'; +import { translations, type Lang } from '@data/i18n'; import Links from '@components/Links.astro'; -const { lang = 'no' } = Astro.props; +const { lang = 'no' } = Astro.props as { lang?: Lang }; const t = translations[lang].footer; --- diff --git a/src/components/Hero.astro b/src/components/Hero.astro index 54769bf..e018644 100644 --- a/src/components/Hero.astro +++ b/src/components/Hero.astro @@ -1,8 +1,8 @@ --- import logo from '@assets/logo.png'; import { Image } from 'astro:assets'; -import { translations } from '@data/i18n.js'; -const { lang = 'no' } = Astro.props; +import { translations, type Lang } from '@data/i18n'; +const { lang = 'no' } = Astro.props as { lang?: Lang }; const t = translations[lang].hero; --- diff --git a/src/components/Nav.astro b/src/components/Nav.astro index 8d7e4c2..6f38e70 100644 --- a/src/components/Nav.astro +++ b/src/components/Nav.astro @@ -1,12 +1,11 @@ --- import NavLink from '@components/NavLink.astro'; - -import { translations } from '@data/i18n.js'; -const { lang = 'no' } = Astro.props; +import { translations, type Lang } from '@data/i18n'; +const { lang = 'no' } = Astro.props as { lang?: Lang }; const t = translations[lang].nav; const { pathname } = Astro.url; -function getLangSwitchPath(path, lang) { +function getLangSwitchPath(path: string, lang: string) { if (lang === 'no') { if (path === '/') return '/en/'; if (path.startsWith('/en/')) return path.replace('/en/', '/'); diff --git a/src/components/Program.astro b/src/components/Program.astro index b5f1d92..9c345af 100644 --- a/src/components/Program.astro +++ b/src/components/Program.astro @@ -1,9 +1,17 @@ --- -import { translations } from '@data/i18n.js'; -const { lang = 'no', data } = Astro.props; +import { translations, type Lang } from '@data/i18n'; +const { lang = 'no', data } = Astro.props as { lang?: Lang, data: any }; const t = translations[lang].program; -const convertDate = (date) => { +type ProgramItem = { + time: string; + event: string; + price?: string | null; + cost?: string | null; + url?: string; +}; + +const convertDate = (date: string | Date) => { let d = date; if (!(d instanceof Date)) { d = new Date(d); @@ -26,7 +34,7 @@ const convertDate = (date) => {

{convertDate(date)}