pinafore/src/routes/_layout.html
Nolan Lawson 4bd181d3cc
fix: update Sapper to latest (#775)
* fix: update to latest sapper

fixes #416

* fix error and debug pages

* requestIdleCallback makes column switching feel way nicer than double rAF

* add export feature

* add better csp info

* workaround for sapper sub-page issue

* clarify in readme about exporting

* fix now config

* switch from rIC to triple raf

* style-loader is no longer used

* update theming guide
2018-12-11 07:31:48 -08:00

46 lines
1.2 KiB
HTML

<Nav {page} />
<div class="main-content">
<main class="{infiniteScrollPage ? 'infinite-scroll-page' : ''}">
<svelte:component this={child.component} {...child.props} />
</main>
{#if !$isUserLoggedIn && page === 'home'}
<InformationalFooter />
{/if}
</div>
<style>
/* this avoids a flash of the background color when switching timelines */
.infinite-scroll-page {
min-height: 100vh;
}
</style>
<script>
import { store } from './_store/store'
import { observe } from 'svelte-extras'
export default {
components: {
Nav: './_components/Nav.html',
InformationalFooter: './_components/InformationalFooter.html'
},
oncreate () {
if (process.browser && process.env.NODE_ENV !== 'production') {
window.layoutObject = this
}
this.observe('page', page => {
console.log('currentPage', page)
this.store.set({ currentPage: page })
})
},
store: () => store,
computed: {
page: ({ child }) => child.props.path.slice(1) || 'home',
infiniteScrollPage: ({ $isUserLoggedIn, page }) => $isUserLoggedIn && !page.startsWith('settings')
},
methods: {
observe
}
}
</script>