ssr
All checks were successful
deploy to production / deploy (push) Successful in 1m23s

This commit is contained in:
2023-12-15 12:35:45 +00:00
parent 35168ddaab
commit 241513e32f
20 changed files with 161 additions and 94 deletions

View File

@@ -27,10 +27,10 @@
}
onMount(() => {
// Initial check
checkHomePage()
checkScroll()
if (typeof window !== "undefined") {
// Initial check
checkHomePage()
checkScroll()
// Listen for changes
window.addEventListener("scroll", checkScroll)
window.addEventListener("popstate", checkHomePage)
@@ -45,8 +45,10 @@
$: {
console.log($refresh)
checkHomePage()
checkScroll()
if (typeof window !== "undefined") {
checkHomePage()
checkScroll()
}
}
let show = false
$: console.log(show)

View File

@@ -183,7 +183,7 @@
<div class="submenu-img">
<img
src="{`${apiBaseURL}navigation/${$navigation?.id}/${submenu.image?.src}?filter=${
window?.innerWidth > 500 ? 'xl' : 'm'
typeof window !== 'undefined' && window?.innerWidth > 500 ? 'xl' : 'm'
}`}"
alt="img"
/>

View File

@@ -218,7 +218,7 @@
<img
use:pushImages
src="{`${apiBaseURL}navigation/${$navigation.id}/${imgSrc}?filter=${
window?.innerWidth > 500 ? 'xl' : 'm'
typeof window !== 'undefined' && window?.innerWidth > 500 ? 'xl' : 'm'
}`}"
alt="img"
class="img img-menu"

View File

@@ -72,7 +72,7 @@
}
}
let innerWidth = window?.innerWidth || 0
let innerWidth = typeof window !== "undefined" ? window?.innerWidth || 0 : 0
if (typeof window !== "undefined") {
onMount(() => {
const handleResize = () => {

View File

@@ -48,12 +48,13 @@
{#each siteImages as image, i (i)}
<swiper-slide class="relative" id="imageSlide">
<div class="image-container">
<img
src="{`${apiBaseURL}content/${siteId}/${image.image?.src}?filter=${
window?.innerWidth > 500 ? 'xl' : 'm'
}`}"
alt="Bild"
/>
{#if typeof window !== "undefined"}
<img
src="{`${apiBaseURL}content/${siteId}/${image.image?.src}?filter=${
typeof window !== 'undefined' && window?.innerWidth > 500 ? 'xl' : 'm'
}`}"
alt="Bild"
/>{/if}
</div>
</swiper-slide>
{/each}
@@ -62,7 +63,9 @@
{:else if image}
<div class="image-container single flex">
<img
src="{`${apiBaseURL}content/${siteId}/${image.image?.src}?filter=${window?.innerWidth > 500 ? 'xl' : 'm'}`}"
src="{`${apiBaseURL}content/${siteId}/${image.image?.src}?filter=${
typeof window !== 'undefined' && window?.innerWidth > 500 ? 'xl' : 'm'
}`}"
alt="Bild"
/>
</div>

View File

@@ -22,7 +22,7 @@
<div class="img-container">
<img
src="{`${apiBaseURL}content/${siteId}/${col.image?.src}?filter=${
window?.innerWidth > 500 ? 'xl' : 'm'
typeof window !== 'undefined' && window?.innerWidth > 500 ? 'xl' : 'm'
}`}"
alt="img"
/>

View File

@@ -9,7 +9,7 @@
<div class="imgContainer">
<img
src="{`${apiBaseURL}content/${siteId}/${col.mainPicture?.src}?filter=${
window?.innerWidth > 500 ? 'xl' : 'm'
typeof window !== 'undefined' && window?.innerWidth > 500 ? 'xl' : 'm'
}`}"
alt="img"
/>

View File

@@ -48,7 +48,7 @@
<div class="img-container">
<img
src="{`${apiBaseURL}content/${siteId}/${product.image?.src}?filter=${
window?.innerWidth > 500 ? 'xl' : 'm'
typeof window !== 'undefined' && window?.innerWidth > 500 ? 'xl' : 'm'
}`}"
alt="img"
/>

View File

@@ -6,7 +6,7 @@
</script>
<main class="teaser">
{#if index % 2 == 0 || window?.innerWidth < 1023}
{#if index % 2 == 0 || typeof window !== 'undefined' && window?.innerWidth < 1023}
<Image siteId="{site?.id}" siteImages="{site?.teaserImages || []}" />
{/if}
<div class="content">
@@ -14,7 +14,7 @@
<p>{site?.teaserDescription}</p>
<button on:click="{() => navigate(site.path)}">MEHR</button>
</div>
{#if index % 2 == 1 && window?.innerWidth > 1023}
{#if index % 2 == 1 && typeof window !== 'undefined' && window?.innerWidth > 1023}
<Image siteId="{site?.id}" siteImages="{site?.teaserImages || []}" />
{/if}
</main>