From 87aa1689f375b8b72e97cdd8b7a02c865f764a41 Mon Sep 17 00:00:00 2001 From: Mario Linz Date: Tue, 31 May 2022 15:55:35 +0200 Subject: [PATCH] =?UTF-8?q?Content-Seiten=20und=20Language=20Chooser=20+?= =?UTF-8?q?=20Collections=20so=20=C3=BCberarbeitet,=20dass=20ein=20Umschal?= =?UTF-8?q?ten=20zwischen=20Sprachen=20und=20Pages=20m=C3=B6glich=20ist.?= =?UTF-8?q?=20Collection=20der=20Seiten=20wurde=20um=20eine=20Priorit?= =?UTF-8?q?=C3=A4t=20erweitert.=20Navigation=20zeigt=20aktives=20Item=20an?= =?UTF-8?q?.=20Entsprechende=20CSS=20Klassen=20angepasst=20und=20f=C3=BCr?= =?UTF-8?q?=20neue=20Projekte=20sauberer=20strukturiert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/collections/content.yml | 10 +- src/api.ts | 13 +- src/components/routes/Content.svelte | 27 +++- src/components/widgets/LanguageChooser.svelte | 2 - src/components/widgets/Navigation.svelte | 4 +- src/css/theme-2022/components/header.less | 93 -------------- src/css/theme-2022/components/navigation.less | 121 ++++++++++++++++++ src/css/theme-2022/main.less | 1 + 8 files changed, 162 insertions(+), 109 deletions(-) diff --git a/api/collections/content.yml b/api/collections/content.yml index fc83484..207f9fb 100644 --- a/api/collections/content.yml +++ b/api/collections/content.yml @@ -112,7 +112,7 @@ fields: meta: helperText: de: "Entsprechende Seiten in einer anderen Sprache, die mit den selben zugewiesenen Stichworten gekennzeichnet sind, können bei Umschaltung der Seitensprache gefunden werden." - en: "" + en: "Corresponding pages in another language, marked with the same assigned keywords, can be found when switching the page language." widget: chipArray label: de: Verknüpfungs-Stichworte @@ -133,6 +133,14 @@ fields: 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: priority + type: number + meta: + defaultValue: [0] + label: { de: "Priorität", en: "Priority" } + helperText: + de: "Sind mehr als ein Stichwort mit einer Seite verknüpft, führt die Priorität (z.B.: eine Zahl von 0..10..x) der gefundenen Seiten zu einer automatischen Vorauswahl aus den gefundenen Seiten." + en: "If more than one keyword is linked to a page, the priority (e.g. a number 0..10..x) of the pages found leads to an automatic preselection from the pages found." - name: blocks type: object[] meta: diff --git a/src/api.ts b/src/api.ts index 2627e7d..4c0cc17 100644 --- a/src/api.ts +++ b/src/api.ts @@ -186,13 +186,18 @@ export const sendEmail = async (type: string = "contactForm", data: any, noToken }) } -export const getContent = async (path: string, lang: string, filter?: APIParams): Promise => { +export const getContent = async (locale: string, filter?: APIParams, params?: APIParams): Promise => { const c = await api("content", { - limit: 1, - filter: { path, locale: lang, ...filter }, + // limit: 1, + params: { + sort: "priority", + ...params, + }, + filter: { locale, ...filter }, + sort: "-priority", }) if (c?.data?.length) { - return c.data[0] + return c.data } return null } diff --git a/src/components/routes/Content.svelte b/src/components/routes/Content.svelte index 40e40f5..1e920da 100644 --- a/src/components/routes/Content.svelte +++ b/src/components/routes/Content.svelte @@ -1,6 +1,7 @@ diff --git a/src/components/widgets/Navigation.svelte b/src/components/widgets/Navigation.svelte index 37955a6..068d1f3 100644 --- a/src/components/widgets/Navigation.svelte +++ b/src/components/widgets/Navigation.svelte @@ -40,7 +40,7 @@ {item.settings.title} {:else} - + {item.settings.title} {/if} @@ -72,7 +72,7 @@ {item.settings.title} diff --git a/src/css/theme-2022/components/header.less b/src/css/theme-2022/components/header.less index 8c25e22..00d26fb 100755 --- a/src/css/theme-2022/components/header.less +++ b/src/css/theme-2022/components/header.less @@ -37,97 +37,4 @@ header { width: 80%; } } - - nav { - list-style-type: none; - margin-top: @space-md; - display: flex; - justify-content: flex-end; - align-items: center; - gap: @space-md; - - @media (max-width: 992px) { - display: none; - } - - a { - &.active { - color: @primary; - } - } - - & > * { - text-decoration: none; - transition: @transition-default; - font-weight: 500; - - &:hover { - color: @primary; - } - } - } - - .nav-mobile-toggle { - display: none; - cursor: pointer; - margin: @space-md 0 0 auto; - - @media (max-width: 992px) { - display: block; - } - } - - nav.main-mobile { - display: none; - position: fixed; - top: @header-height; - left: 0; - right: 0; - bottom: 0; - background-color: @surface; - z-index: 9999; - margin: 0; - overflow-y: auto; - - @media (max-width: 768px) { - top: @header-height-max-768; - } - - &.show { - display: flex; - flex-direction: column; - justify-content: flex-start; - align-items: center; - } - - .bg-image { - position: absolute; - left: 0; - top: 0; - } - - .nav-item { - align-self: center; - display: block; - text-align: center; - color: @primary; - font-size: 18px; - font-weight: 700; - - a { - transition: @transition-default; - padding: @space-xs; - - &:hover { - color: @secondary; - } - - &.tel-box { - padding: 0 @space-md 0 0; - margin-bottom: @space-md; - color: @primary; - } - } - } - } } diff --git a/src/css/theme-2022/components/navigation.less b/src/css/theme-2022/components/navigation.less index 8ac5650..1be2da4 100644 --- a/src/css/theme-2022/components/navigation.less +++ b/src/css/theme-2022/components/navigation.less @@ -1,3 +1,5 @@ +// NAVIGATION - GENERAL + nav { @media (max-width: 992px) { display: none; @@ -28,3 +30,122 @@ nav { display: block; } } + +// HEADER + +header { + nav { + list-style-type: none; + margin-top: @space-md; + display: flex; + justify-content: flex-end; + align-items: center; + gap: @space-md; + + @media (max-width: 992px) { + display: none; + } + + a { + &.active { + color: @primary; + } + } + + & > * { + text-decoration: none; + transition: @transition-default; + font-weight: 500; + + &:hover { + color: @primary; + } + } + } + + .nav-mobile-toggle { + display: none; + cursor: pointer; + margin: @space-md 0 0 auto; + + @media (max-width: 992px) { + display: block; + } + } + + nav.main-mobile { + display: none; + position: fixed; + top: @header-height; + left: 0; + right: 0; + bottom: 0; + background-color: @surface; + z-index: 9999; + margin: 0; + overflow-y: auto; + + @media (max-width: 768px) { + top: @header-height-max-768; + } + + &.show { + display: flex; + flex-direction: column; + justify-content: flex-start; + align-items: center; + } + + .bg-image { + position: absolute; + left: 0; + top: 0; + } + + .nav-item { + align-self: center; + display: block; + text-align: center; + color: @primary; + font-size: 18px; + font-weight: 700; + + a { + transition: @transition-default; + padding: @space-xs; + + &:hover { + color: @secondary; + } + + &.tel-box { + padding: 0 @space-md 0 0; + margin-bottom: @space-md; + color: @primary; + } + } + } + } +} + +// FOOTER + +footer { + nav.footer { + display: flex; + justify-content: center; + gap: @space-md; + + a { + color: @on-background; + + &:hover { + text-decoration: underline; + } + + &.active { + color: @primary; + } + } + } +} diff --git a/src/css/theme-2022/main.less b/src/css/theme-2022/main.less index e54c422..356abca 100644 --- a/src/css/theme-2022/main.less +++ b/src/css/theme-2022/main.less @@ -40,6 +40,7 @@ @import "components/section"; @import "components/header"; @import "components/footer"; +@import "components/navigation"; @import "components/news"; @import "components/services"; @import "components/specials";