Skip to content

Commit 09e876d

Browse files
authored
Merge pull request #120 from CreativeCodeBerlin/fix-project-flicker
I make sure the <section> for projects is not rendered server-side by adding v-if="showProject" Then in onMounted, after project index has been updated: showProject.value = true Also switched to black bacground by default. More projects have that than white.
2 parents e4fed85 + b86289d commit 09e876d

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

app.vue

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<template>
22
<div class="app">
33
<header>
4-
<section class="project">
4+
<div ref="projectMount"></div>
5+
<section v-if="showProject" class="project">
56
<h2 class="credits">
67
Background art by
78
<template v-if="project.author_url">
@@ -12,8 +13,7 @@
1213
</template>
1314
</h2>
1415
<div class="display">
15-
<iframe :style="{ transform: `scale(${project.scale})` }" :src="project.url">
16-
</iframe>
16+
<iframe :style="{ transform: `scale(${project.scale})` }" :src="project.url" />
1717
</div>
1818
</section>
1919
<svg width="49" height="65" viewBox="0 0 49 65" fill="none" xmlns="http://www.w3.org/2000/svg" class="logo">
@@ -34,17 +34,17 @@
3434
import projects from 'assets/projects';
3535
import links from 'assets/links';
3636
37+
const showProject = ref(false)
3738
const projectIndex = useCookie('projectIndex', {
3839
default: () => Math.floor(Math.random() * projects.length),
3940
})
40-
41-
4241
const project = ref(projects[projectIndex.value])
4342
provide('project', project)
4443
onMounted(() => {
4544
projectIndex.value += 1
4645
projectIndex.value %= projects.length
4746
project.value = projects[projectIndex.value]
47+
showProject.value = true
4848
})
4949
5050
const route = useRoute()
@@ -72,8 +72,8 @@ useHead(() => ({
7272
<style lang="scss">
7373
:root {
7474
--primary: #cb5955;
75-
--foreground: black;
76-
--background: white;
75+
--foreground: white;
76+
--background: black;
7777
7878
&.black {
7979
--foreground: white;
@@ -129,11 +129,6 @@ a {
129129
z-index: 0;
130130
min-height: 100vh;
131131
132-
&.black {
133-
--foreground: white;
134-
--background: black;
135-
}
136-
137132
@media screen and (min-width: 800px) {
138133
display: flex;
139134
}

0 commit comments

Comments
 (0)