From 416419a357de2a2311d8b2f972c21f3444fd8c2f Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sat, 10 Feb 2024 17:54:37 +0100 Subject: offer a language choice at the bottom --- asset-sources/fietsboek.ts | 14 ++++++++++++++ asset-sources/theme.scss | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) (limited to 'asset-sources') diff --git a/asset-sources/fietsboek.ts b/asset-sources/fietsboek.ts index b76b98b..bdd56ef 100644 --- a/asset-sources/fietsboek.ts +++ b/asset-sources/fietsboek.ts @@ -51,6 +51,20 @@ function addHandler( forEach((obj) => obj.addEventListener(event, handler as EventListener)); } +/** + * Handler for when a language is clicked. Sets the cookie to the correct locale. + * + * @param event - The triggering event. + */ +function languageClicked(event: MouseEvent) { + let language = (event.target as HTMLElement).getAttribute("data-langcode"); + document.cookie = "fietsboek_locale=" + language; + window.location.reload(); + event.preventDefault(); +} + +addHandler(".language-choice", "click", languageClicked); + /** * Handler for when a tag is clicked. Removes the tag from the tag list. * diff --git a/asset-sources/theme.scss b/asset-sources/theme.scss index 8e0f001..610e688 100644 --- a/asset-sources/theme.scss +++ b/asset-sources/theme.scss @@ -1,14 +1,39 @@ +html { + min-height: 100%; +} + body { font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 300; color: #101010; background: #efefef; + min-height: 100vh; + display: flex; + flex-direction: column; } strong { font-weight: 700; } +#mainContent { + flex: 1; +} + +#siteFooter { + padding-bottom: 20px; +} + +#languageChooser { + display: flex; + + .language-choice { + display: block; + margin-right: 20px; + text-decoration: none; + } +} + .brand-link { text-decoration: none; } -- cgit v1.2.3 From 3968fad3a060c40a84eb07a0cf93e22e1161da61 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sat, 10 Feb 2024 21:53:01 +0100 Subject: fix eslint --- asset-sources/fietsboek.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'asset-sources') diff --git a/asset-sources/fietsboek.ts b/asset-sources/fietsboek.ts index bdd56ef..1073ae4 100644 --- a/asset-sources/fietsboek.ts +++ b/asset-sources/fietsboek.ts @@ -57,7 +57,7 @@ function addHandler( * @param event - The triggering event. */ function languageClicked(event: MouseEvent) { - let language = (event.target as HTMLElement).getAttribute("data-langcode"); + const language = (event.target as HTMLElement).getAttribute("data-langcode"); document.cookie = "fietsboek_locale=" + language; window.location.reload(); event.preventDefault(); -- cgit v1.2.3