improve SSR hiding

This commit is contained in:
Nolan Lawson 2018-01-20 20:30:49 -08:00
parent aa888500ec
commit 73fbbad0cc
6 changed files with 60 additions and 37 deletions

View file

@ -0,0 +1,13 @@
<div class="{{hidden ? 'hidden' : ''}}">
<slot></slot>
</div>
<script>
export default {
data: () => ({
hidden: true
}),
oncreate () {
this.set({hidden: !process.browser})
}
}
</script>

View file

@ -1,18 +1,20 @@
<FreeTextLayout>
<div class="not-logged-in-home {{hidden ? 'hidden' : ''}}">
<div class="banner">
<svg aria-hidden="true" class="logo">
<use xlink:href="#pinafore-logo" />
</svg>
<h1>Pinafore</h1>
<HiddenFromSSR>
<FreeTextLayout>
<div class="not-logged-in-home">
<div class="banner">
<svg aria-hidden="true" class="logo">
<use xlink:href="#pinafore-logo" />
</svg>
<h1>Pinafore</h1>
</div>
<p>Pinafore is a web client for <a rel="noopener" target="_blank" href="https://joinmastodon.org">Mastodon</a>, optimized for speed and simplicity.</p>
<p>To get started, <a href="/settings/instances/add">log in to an instance</a>.</p>
<p>Don't have an instance? <a rel="noopener" target="_blank" href="https://joinmastodon.org">Join Mastodon!</a></p>
</div>
<p>Pinafore is a web client for <a rel="noopener" target="_blank" href="https://joinmastodon.org">Mastodon</a>, optimized for speed and simplicity.</p>
<p>To get started, <a href="/settings/instances/add">log in to an instance</a>.</p>
<p>Don't have an instance? <a rel="noopener" target="_blank" href="https://joinmastodon.org">Join Mastodon!</a></p>
</div>
</FreeTextLayout>
</FreeTextLayout>
</HiddenFromSSR>
<style>
.not-logged-in-home {
margin: 10px;
@ -43,16 +45,12 @@
</style>
<script>
import FreeTextLayout from './FreeTextLayout.html'
import HiddenFromSSR from './HiddenFromSSR.html'
export default {
components: {
FreeTextLayout
},
data: () => ({
hidden: true
}),
oncreate: function () {
this.set({hidden: !process.browser})
FreeTextLayout,
HiddenFromSSR
}
}
</script>

View file

@ -6,11 +6,13 @@
{{#if $isUserLoggedIn}}
<LazyTimeline timeline='federated' />
{{else}}
<FreeTextLayout>
<h1>Federated</h1>
<HiddenFromSSR>
<FreeTextLayout>
<h1>Federated</h1>
<p>Your federated timeline will appear here when logged in.</p>
</FreeTextLayout>
<p>Your federated timeline will appear here when logged in.</p>
</FreeTextLayout>
</HiddenFromSSR>
{{/if}}
</Layout>
@ -19,13 +21,15 @@
import LazyTimeline from './_components/LazyTimeline.html'
import FreeTextLayout from './_components/FreeTextLayout.html'
import { store } from './_utils/store.js'
import HiddenFromSSR from './_components/HiddenFromSSR'
export default {
store: () => store,
components: {
Layout,
LazyTimeline,
FreeTextLayout
FreeTextLayout,
HiddenFromSSR
}
}
</script>

View file

@ -6,11 +6,13 @@
{{#if $isUserLoggedIn}}
<LazyTimeline timeline='local' />
{{else}}
<FreeTextLayout>
<h1>Local</h1>
<HiddenFromSSR>
<FreeTextLayout>
<h1>Local</h1>
<p>Your local timeline will appear here when logged in.</p>
</FreeTextLayout>
<p>Your local timeline will appear here when logged in.</p>
</FreeTextLayout>
</HiddenFromSSR>
{{/if}}
</Layout>
@ -19,13 +21,15 @@
import LazyTimeline from './_components/LazyTimeline.html'
import FreeTextLayout from './_components/FreeTextLayout.html'
import { store } from './_utils/store.js'
import HiddenFromSSR from './_components/HiddenFromSSR'
export default {
store: () => store,
components: {
Layout,
LazyTimeline,
FreeTextLayout
FreeTextLayout,
HiddenFromSSR
}
}
</script>

View file

@ -3,21 +3,25 @@
</:Head>
<Layout page='notifications'>
<FreeTextLayout>
<h1>Notifications</h1>
<HiddenFromSSR>
<FreeTextLayout>
<h1>Notifications</h1>
<p>Your notifications will appear here when logged in.</p>
</FreeTextLayout>
<p>Your notifications will appear here when logged in.</p>
</FreeTextLayout>
</HiddenFromSSR>
</Layout>
<script>
import Layout from './_components/Layout.html';
import FreeTextLayout from './_components/FreeTextLayout.html'
import HiddenFromSSR from './_components/HiddenFromSSR'
export default {
components: {
Layout,
FreeTextLayout
FreeTextLayout,
HiddenFromSSR
},
};
</script>

View file

@ -18,7 +18,7 @@ body.offline,body.theme-hotpants.offline,body.theme-majesty.offline,body.theme-o
<noscript>
<style>
.not-logged-in-home.hidden {
.hidden {
opacity: 1;
}
</style>