wm-fontis-tibi-2023/frontend/src/App.svelte

249 lines
6.4 KiB
Svelte
Raw Normal View History

2023-07-13 13:12:19 +02:00
<script lang="ts">
2023-07-13 22:45:49 +02:00
import Footer from "./lib/components/Footer.svelte"
2023-07-13 18:43:19 +02:00
import Header from "./lib/components/Menu/Header.svelte"
import Menu from "./lib/components/Menu/Menu.svelte"
2023-07-14 13:58:27 +02:00
import NotFound from "./lib/components/NotFound.svelte"
import Rows from "./lib/components/Pagebuilder/Rows.svelte"
2023-11-12 11:02:26 +01:00
import {
location,
navigation,
pages,
serviceNavigation,
rerender,
mediaLibrary,
team,
jobOffers,
modules,
} from "./lib/store"
2023-07-16 08:21:49 +02:00
import { onMount, onDestroy } from "svelte"
2023-07-14 13:58:27 +02:00
import { Route, Router } from "svelte-routing"
import { loadPages } from "./lib/functions/getPages"
import { loadNavigation } from "./lib/functions/loadNavigation"
2023-07-16 08:21:49 +02:00
import ScrollTop from "./lib/components/widgets/scrollTop.svelte"
import ScrollDown from "./lib/components/widgets/scrollDown.svelte"
2023-11-12 11:02:26 +01:00
import { loadLibrary } from "./lib/functions/loadLibrary"
import { loadModules } from "./lib/functions/loadModules"
2023-11-19 18:37:52 +01:00
import "external-svg-loader"
2023-07-13 13:12:19 +02:00
export let url = ""
if (url) {
let l = url.split("?")
$location = {
path: l[0],
search: l.length > 1 ? l[1] : "",
hash: "",
categoryPath: l[0].replace(/\/[^_\/]+_[^\/]+$/, ""),
push: false,
pop: false,
}
}
2023-07-14 13:58:27 +02:00
async function getPages() {
let pagesArray = await loadPages()
let pagesRes: Pages = {}
2023-11-12 11:02:26 +01:00
let teamRes: Pages = {}
let jobOffersRes: Pages = {}
2023-07-14 13:58:27 +02:00
pagesArray.forEach((e) => {
2023-11-12 12:45:32 +01:00
if (!e.active) return
2023-11-12 11:02:26 +01:00
if (e.type == "page") {
pagesRes[e.path] = e
} else if (e.type == "teamMembers") {
teamRes[e.path] = e
} else if (e.type == "jobOffers") {
jobOffersRes[e.path] = e
} else {
pagesRes[e.path] = e
}
2023-07-14 13:58:27 +02:00
})
$pages = pagesRes
2023-11-12 11:02:26 +01:00
$team = teamRes
2023-12-08 14:28:01 +01:00
2023-11-12 11:02:26 +01:00
$jobOffers = jobOffersRes
2023-07-14 13:58:27 +02:00
}
async function getNavigation() {
let nav: Navigation[] = await loadNavigation()
$navigation = nav[0]
$serviceNavigation = nav[1]
}
2023-11-12 11:02:26 +01:00
async function getLibrary() {
let library: MediaLibrary[] = await loadLibrary()
let lib = {}
library.forEach((e) => {
lib[e.id] = e
})
$mediaLibrary = lib
}
async function getModules() {
let moduleArray: Module[] = await loadModules()
let mod = {}
moduleArray.forEach((e) => {
mod[e.id] = e
})
$modules = mod
}
2023-07-14 13:58:27 +02:00
getNavigation()
getPages()
2023-11-12 11:02:26 +01:00
getLibrary()
2023-11-12 12:45:32 +01:00
getModules()
2023-12-07 21:24:09 +01:00
console.log("TESTR")
2023-07-14 13:58:27 +02:00
let activeMenu = false
2023-07-14 21:32:33 +02:00
$: {
2023-12-07 21:24:09 +01:00
if (typeof window !== "undefined") {
if (activeMenu) {
document.body.classList.add("overflow")
} else {
document.body.classList.remove("overflow")
}
2023-07-14 21:32:33 +02:00
}
}
2023-07-13 13:12:19 +02:00
</script>
2023-07-13 18:43:19 +02:00
<main class="">
<Header bind:active="{activeMenu}" />
2023-07-14 13:58:27 +02:00
<div class="content-container" id="siteContainer" data-url="{url}">
<Router url="{url}">
<Route path="/">
<Rows path="/" homepage="{true}" />
</Route>
<Route path="/*path" let:params>
2023-07-15 18:15:17 +02:00
{#key $rerender}
<Rows path="/{params?.path}" homepage="{false}" />
{/key}
2023-07-14 13:58:27 +02:00
</Route>
<Route>
<NotFound />
</Route>
</Router>
</div>
2023-09-01 17:15:41 +02:00
{#key $rerender}
<Footer />
{/key}
2023-07-13 18:43:19 +02:00
</main>
2023-07-13 16:28:54 +02:00
2023-07-16 08:21:49 +02:00
<ScrollTop />
<ScrollDown />
2023-07-13 22:45:49 +02:00
<Menu bind:active="{activeMenu}" />
2023-07-13 18:43:19 +02:00
<style lang="less" global>
@import "./lib/assets/css/main.less";
@import "./lib/assets/css/base.less";
2023-07-16 13:50:53 +02:00
@import "swiper/swiper-bundle.min.css";
@import "swiper/modules/effect-fade/effect-fade";
@import "swiper/modules/navigation/navigation";
@import "swiper/modules/pagination/pagination";
2023-07-14 21:32:33 +02:00
2023-07-16 13:50:53 +02:00
.HP {
h2 {
2023-07-17 09:24:08 +02:00
font-size: 2.1rem !important;
@media @tablet {
font-size: 3.2rem !important;
}
2023-07-16 13:50:53 +02:00
}
}
2023-07-14 21:32:33 +02:00
.swiper-button-prev,
.swiper-button-next {
color: @font-color;
height: 70px;
width: 70px;
bottom: 0px !important;
top: initial !important;
transform: scale(0.5);
transform-origin: bottom !important;
}
2023-07-15 18:15:17 +02:00
2023-07-14 21:32:33 +02:00
.swiper-button-prev {
right: 18%;
left: initial !important;
}
2023-07-15 18:15:17 +02:00
2023-07-14 21:32:33 +02:00
.swiper-button-next {
right: 3%;
transform-origin: right;
}
2023-07-15 18:15:17 +02:00
2023-07-14 21:32:33 +02:00
@media @tablet {
.swiper-button-prev,
.swiper-button-next {
bottom: initial !important;
top: 100px !important;
transform: scale(0.8);
transform-origin: center !important;
}
.swiper-button-prev {
left: 0% !important;
right: initial !important;
left: initial !important;
}
.swiper-button-next {
right: 0% !important;
transform-origin: right;
}
}
@media @desktop {
.swiper-button-prev,
.swiper-button-next {
top: 110px !important;
transform: scale(1);
}
}
h1,
h2 {
font-family: "Libre Caslon Text", serif;
}
.overflow {
overflow: hidden !important;
}
2023-07-13 18:43:19 +02:00
main {
2023-07-13 22:45:49 +02:00
min-height: 100vh;
2023-07-14 21:32:33 +02:00
background-color: @bg-color;
2023-07-13 22:45:49 +02:00
display: flex;
flex-direction: column;
justify-content: space-between;
2023-07-13 18:43:19 +02:00
height: 100%;
width: 100%;
2023-07-15 18:15:17 +02:00
.content-container {
flex: 1;
}
}
html,
body {
2023-08-17 10:01:56 +02:00
font-family: "Libre Franklin", sans-serif;
2023-09-01 14:09:35 +02:00
button {
font-family: "Libre Franklin", sans-serif;
}
2023-07-13 18:43:19 +02:00
@media @mobile {
font-size: @bodyfontsize;
2023-07-14 21:32:33 +02:00
line-height: 1.4;
2023-07-13 18:43:19 +02:00
}
@media @tablet {
font-size: @bodyfontsize_desktop;
2023-07-14 21:32:33 +02:00
line-height: 1.6;
2023-07-13 18:43:19 +02:00
}
}
2023-07-13 16:28:54 +02:00
@font-face {
font-display: swap;
font-family: "Libre Franklin";
font-style: normal;
font-weight: 400;
src: url("./lib/assets/fonts/libre-franklin-v13-latin-regular.woff2") format("woff2");
}
2023-07-14 21:32:33 +02:00
@font-face {
font-display: swap;
font-family: "Libre Caslon Text";
font-style: normal;
font-weight: 400;
src: url("./lib/assets/fonts/LibreCaslonText-Regular.woff2") format("woff2");
}
2023-07-13 16:28:54 +02:00
</style>