This commit is contained in:
2023-07-17 07:24:08 +00:00
parent 383c1be382
commit 0e1de15d7c
17 changed files with 164 additions and 38 deletions

View File

@@ -5,7 +5,7 @@
$: nextpage = $navigation?.pages[0]
function getNextPage(pages) {
if (location.pathname == "/" || location.pathname == "") return
let currPage = pages.find(
(page) => Object.values($pages)?.find((o) => o.id == page.page)?.path == location.pathname
)
@@ -18,31 +18,37 @@
nextIndex = currIndex + 1
}
nextpage = pages[nextIndex]
console.log(nextpage, pages, nextIndex)
}
setInterval(() => {
getNextPage($navigation.pages)
}, 1000)
let showNext = true
$: {
if ($rerender) {
if (location.pathname != "/") {
getNextPage($navigation.pages)
}
if (location.pathname.split("/").length >= 2) {
showNext = false
} else {
showNext = true
}
}
}
</script>
<div class="footer">
<button
class="upper-part"
on:click="{() => {
$rerender = $rerender + 1
navigate(Object.values($pages)?.find((o) => o.id == nextpage.page)?.path || '/')
}}"
>
<div class="upper"><img src="/media/arrow-right.svg" alt="arrow" /> nächstes Thema</div>
<div class="lower">{nextpage?.name}</div>
</button>
{#if showNext}
<button
class="upper-part"
on:click="{() => {
$rerender = $rerender + 1
navigate(Object.values($pages)?.find((o) => o.id == nextpage.page)?.path || '/')
}}"
>
<div class="upper"><img src="/media/arrow-right.svg" alt="arrow" /> nächstes Thema</div>
<div class="lower">{nextpage?.name}</div>
</button>{/if}
<div class="lower-part">
<div class="links">
<button>Datenschutz</button>
@@ -90,7 +96,6 @@
.lower-part {
padding: 40px 40px;
background-color: @bg-color-secondary;
width: 100%;
display: flex;