summaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorJoe Carstairs <jcarstairs@scottlogic.com>2023-08-15 19:15:27 +0100
committerJoe Carstairs <jcarstairs@scottlogic.com>2023-08-15 19:15:27 +0100
commit53f29bac911b13b2bef0125de22773bf26ce5a90 (patch)
treee4dad6d88e2fe4c4eda8ff286db50d9a6f561242 /src/pages
parent8b009f0ea6ea9d181ba8d0e6549c25645aa697c4 (diff)
Adds homepage
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/[locale]/index.astro95
-rw-r--r--src/pages/[locale]/news/index.astro9
2 files changed, 56 insertions, 48 deletions
diff --git a/src/pages/[locale]/index.astro b/src/pages/[locale]/index.astro
index c32ddf6..3674b9f 100644
--- a/src/pages/[locale]/index.astro
+++ b/src/pages/[locale]/index.astro
@@ -2,9 +2,11 @@
import Page from '$layouts/Page.astro';
import localeStaticPaths from '$lib/localeStaticPaths';
import translate from '$i18n/translate';
-import site from '$i18n/translations/site';
-import home from '$i18n/translations/pages/home';
+import tPage from '$i18n/translations/pages/home';
import type Locale from '$types/Locale';
+import { getMostRecentNewsItem } from '$lib/newsUtils';
+import NewsPreviewLink from '$components/NewsPreviewLink.astro';
+import contactDetails from '$data/contactDetails';
export async function getStaticPaths() {
return localeStaticPaths;
@@ -12,49 +14,60 @@ export async function getStaticPaths() {
const locale = Astro.params.locale as Locale;
const t = translate(locale);
+const mostRecentNewsItem = await getMostRecentNewsItem(locale);
---
-<Page title={t(home, { key: 'title' })}>
+<Page title={t(tPage, { key: 'title' })}>
<section>
- <h1 class="title">{t(site, { key: 'title' })}</h1>
- <h1>Tap-level heidin</h1>
- <h2>Seicont-level heidin</h2>
- <h3>Third-level heidin</h3>
- <h4>Fowert-level heidin</h4>
- <p>
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
- labore et dolore magna aliqua.
- </p>
- <a class="link" href="#">Lairn mair!</a>
- <p>
- Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
- commodo consequat.
- </p>
- <button class="btn">Dae somethin excitin...</button>
- <p>
- Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
- mollit anim id est laborum.
- </p>
+ <h2 set:html={t(tPage, { key: 'news' })} />
+ {mostRecentNewsItem && <NewsPreviewLink newsItem={mostRecentNewsItem} />}
+ <div class="align-end margin-block-start-md">
+ <a href={`/${locale}/news`} class="btn">
+ {t(tPage, { key: 'aw-news' })} ▷
+ </a>
+ </div>
</section>
+
+ <section>
+ <h2 set:html={t(tPage, { key: 'furthsettins' })} />
+ <p set:html={t(tPage, { key: 'furthsettins-para' })} />
+ <div class="align-end">
+ <a href={`/${locale}/furthsettins`} class="btn">
+ {t(tPage, { key: 'aw-furthsettins' })} ▷
+ </a>
+ </div>
+ </section>
+
<section>
- <h2>Seicont-level heidin</h2>
- <h3>Third-level heidin</h3>
- <h4>Fowert-level heidin</h4>
- <p>
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
- labore et dolore magna aliqua.
- </p>
- <a class="link" href="#">Lairn mair!</a>
- <p>
- Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
- commodo consequat.
- </p>
- <button class="btn">Dae somethin excitin...</button>
- <p>
- Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
- mollit anim id est laborum.
- </p>
+ <h2 set:html={t(tPage, { key: 'jyne' })} />
+
+ <h3 set:html={t(tPage, { key: 'why-jyne' })} />
+ <p set:html={t(tPage, { key: 'why-jyne-para-1' })} />
+ <p set:html={t(tPage, { key: 'why-jyne-para-2' })} />
+ <p set:html={t(tPage, { key: 'why-jyne-para-3' })} />
+
+ <h3 set:html={t(tPage, { key: 'hou-jyne' })} />
+ <p set:html={t(tPage, { key: 'hou-jyne-para-1' })} />
+ <p
+ set:html={t(tPage, {
+ key: 'hou-jyne-para-2',
+ membershipEmail: contactDetails.membershipSecretary.emailAddress,
+ })}
+ />
+ </section>
+
+ <section id="contact">
+ <h2 set:html={t(tPage, { key: 'contact' })} />
+ <a class="link" href={`${locale}/mailto:${contactDetails.generalEnquiries.emailAddress}`}>
+ {contactDetails.generalEnquiries.emailAddress}
+ </a>
+ <address>
+ Scots Language Society<br />
+ c/o 61 Cliffburn Road<br />
+ Arbroath<br />
+ Angus<br />
+ DD11 5BA<br />
+ United Kingdom<br />
+ </address>
</section>
</Page>
diff --git a/src/pages/[locale]/news/index.astro b/src/pages/[locale]/news/index.astro
index 0c81fd9..c64fbdb 100644
--- a/src/pages/[locale]/news/index.astro
+++ b/src/pages/[locale]/news/index.astro
@@ -6,18 +6,13 @@ import getLocaleFromPath from '$lib/getLocaleFromPath';
import localeStaticPaths from '$lib/localeStaticPaths';
import { getCollection } from 'astro:content';
import NewsPreviewLink from '$components/NewsPreviewLink.astro';
+import { isNewsItemInLocale } from '$lib/newsUtils';
const allNews = await getCollection('news');
const locale = getLocaleFromPath(Astro.url.pathname);
-const allNewsInLocale = allNews.filter(isInLocale);
+const allNewsInLocale = allNews.filter((item) => isNewsItemInLocale(item, locale));
const t = translate(locale);
-function isInLocale(newsItem: (typeof allNews)[number]) {
- const srcPath = newsItem.id;
- const newsItemLocale = srcPath.slice(0, srcPath.indexOf('/'));
- return newsItemLocale === locale;
-}
-
export async function getStaticPaths() {
return localeStaticPaths;
}