From 5d08a96327afe57b006a454c70d3fc3cb01b469c Mon Sep 17 00:00:00 2001 From: Mario Linz Date: Mon, 30 May 2022 15:57:11 +0200 Subject: [PATCH] =?UTF-8?q?Kleinere=20Anpassungen=20f=C3=BCr=20Seiten-=20u?= =?UTF-8?q?nd=20Navigations-=20Bearbeitung.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/collections/content.yml | 11 +++++------ api/collections/navigation.yml | 2 +- src/api.ts | 2 +- src/components/App.svelte | 4 ++-- src/components/routes/Content.svelte | 4 +++- src/components/widgets/LanguageChooser.svelte | 8 ++------ src/components/widgets/Navigation.svelte | 10 +++++++--- src/css/theme-2022/components/general.less | 2 +- src/css/theme-2022/components/header.less | 6 ++++++ src/css/theme-2022/main.less | 2 +- src/store.ts | 4 +++- 11 files changed, 32 insertions(+), 23 deletions(-) diff --git a/api/collections/content.yml b/api/collections/content.yml index 4be2b11..435fd0b 100644 --- a/api/collections/content.yml +++ b/api/collections/content.yml @@ -25,7 +25,7 @@ meta: primaryText: path columns: - source: path - twig: "{{locale}}{{path}}" + twig: "{{path}}" - source: locale type: flag # Desktop @@ -33,7 +33,7 @@ meta: mediaQuery: "(min-width:600px)" columns: - source: path - twig: "{{locale}}{{path}}" + twig: "{{path}}" - source: locale type: flag @@ -107,15 +107,14 @@ hooks: # Feldliste der Kollektion fields: - !include fields/_locale.yml - - name: name - type: string - meta: - label: { de: "Name der Page (optional)", en: "Page Name (optional)" } - name: path type: string index: [single, unique] meta: label: { de: "Pfad", en: "Path" } + helperText: + de: "Der Pfad muss eindeutig sein und ohne ein Slash (/) beginnen und enden." + en: "The path must be unique and must start and end without a slash (/)." - name: blocks type: object[] meta: diff --git a/api/collections/navigation.yml b/api/collections/navigation.yml index 5b71f5b..873fd54 100644 --- a/api/collections/navigation.yml +++ b/api/collections/navigation.yml @@ -112,7 +112,7 @@ x-page: &page endpoint: "content" mapping: id: "path" - name: "name" + name: "path" params: count: 1 sort: "ASC" diff --git a/src/api.ts b/src/api.ts index 7ebc6ac..4edd20c 100644 --- a/src/api.ts +++ b/src/api.ts @@ -189,7 +189,7 @@ export const sendEmail = async (type: string = "contactForm", data: any, noToken export const getContent = async (path: string, lang: string): Promise => { const c = await api("content", { limit: 1, - filter: { path: path.replace("/" + lang, ""), locale: lang }, + filter: { path, locale: lang }, }) if (c?.data?.length) { return c.data[0] diff --git a/src/components/App.svelte b/src/components/App.svelte index ee50449..836a775 100644 --- a/src/components/App.svelte +++ b/src/components/App.svelte @@ -1,7 +1,7 @@ diff --git a/src/components/widgets/Navigation.svelte b/src/components/widgets/Navigation.svelte index c6aa2b0..37955a6 100644 --- a/src/components/widgets/Navigation.svelte +++ b/src/components/widgets/Navigation.svelte @@ -4,7 +4,7 @@ import { mdiMenu } from "@mdi/js" import { links } from "svelte-routing" - import { navigations, currentLang } from "../../store" + import { navigations, currentLang, location } from "../../store" import LanguageChooser from "./LanguageChooser.svelte" @@ -40,7 +40,7 @@ {item.settings.title} {:else} - + {item.settings.title} {/if} @@ -69,7 +69,11 @@ {:else} diff --git a/src/css/theme-2022/components/general.less b/src/css/theme-2022/components/general.less index a952b3a..292f833 100755 --- a/src/css/theme-2022/components/general.less +++ b/src/css/theme-2022/components/general.less @@ -5,7 +5,7 @@ body { font-size: @font-size-default; font-weight: @font-weight-default; line-height: @font-line-height-default; - font-family: "Montserrat", sans-serif; + font-family: "Nunito", sans-serif; width: 100%; height: 100%; } diff --git a/src/css/theme-2022/components/header.less b/src/css/theme-2022/components/header.less index 3355ae9..8c25e22 100755 --- a/src/css/theme-2022/components/header.less +++ b/src/css/theme-2022/components/header.less @@ -50,6 +50,12 @@ header { display: none; } + a { + &.active { + color: @primary; + } + } + & > * { text-decoration: none; transition: @transition-default; diff --git a/src/css/theme-2022/main.less b/src/css/theme-2022/main.less index 95767a4..e54c422 100644 --- a/src/css/theme-2022/main.less +++ b/src/css/theme-2022/main.less @@ -15,7 +15,7 @@ @error: #eebdbd; @on-error: #eb5757; -@font-size-default: 16px; +@font-size-default: 14px; @font-weight-default: 400; @font-line-height-default: 1.6; diff --git a/src/store.ts b/src/store.ts index 75e3148..faf2d7b 100644 --- a/src/store.ts +++ b/src/store.ts @@ -13,11 +13,13 @@ export const location = writable(initialLocation) // Current Language +export const defaultLang = writable("de") + function langFromUrl(): string { if (new RegExp(`\/[a-zA-Z]*[-[a-zA-Z]*]{0,1}\/[a-zA-Z0-9-]*$`).test(get(location).path)) { return get(location)?.path.split("/")[1] } - return "de" + return get(defaultLang) } export const currentLang = writable(langFromUrl())