Skip to content

Commit

Permalink
feat: do not pass through /locale-choice page
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbertrand committed Jan 3, 2023
1 parent 36bdc2d commit f1fdd5c
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 104 deletions.
9 changes: 9 additions & 0 deletions layouts/empty.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<nuxt />
</template>

<script>
export default {
name: 'Empty',
}
</script>
29 changes: 0 additions & 29 deletions layouts/home.vue

This file was deleted.

93 changes: 88 additions & 5 deletions pages/pix-site/index.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@
<template><div></div></template>
<template>
<client-only v-if="shouldDisplayLocaleChoice">
<main class="home">
<div class="locale-choice">
<h1>
<pix-image
class="logo-pix"
:field="{ url: '/images/logo-pix-blanc.svg', alt: 'Pix' }"
/>
</h1>
<LocaleLink
v-for="locale in locales"
:key="locale.code"
class="locale-choice__link"
:locale="locale"
/>
<pix-image class="planet" :field="{ url: '/images/planet.svg' }" />
</div>
</main>
</client-only>
</template>

<script>
import { language } from '~/config/language'
export default {
layout: 'empty',
nuxtI18n: false,
layout: 'simple',
data() {
return {
locales: language.locales,
shouldDisplayLocaleChoice: false,
}
},
mounted() {
const preferredLocale = this.getLocaleFromCookie()
document.location = preferredLocale
? `/${preferredLocale}/`
: '/locale-choice'
if (preferredLocale) {
document.location = `/${preferredLocale}/`
} else {
this.shouldDisplayLocaleChoice = true
}
},
methods: {
getLocaleFromCookie() {
Expand All @@ -21,3 +50,57 @@ export default {
},
}
</script>

<style lang="scss" scoped>
.home {
width: 100%;
min-width: 0;
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 5rem 1rem 0;
background: url('/images/stars.svg') repeat, $default-gradient;
@include device-is('large-mobile') {
padding: 0;
}
}
.locale-choice {
padding: 3rem 0;
}
.logo-pix {
margin: 0 auto 5vh;
display: block;
width: 11rem;
max-width: 100%;
}
.locale-choice__link + .locale-choice__link {
margin-top: 1rem;
}
.planet {
margin: 5vh auto 0;
display: block;
width: max(16vw, 90%);
}
@include device-is('large-mobile') {
.locale-choice {
position: relative;
}
.planet {
position: absolute;
top: 50%;
right: calc(100% + 4vw);
max-width: unset;
margin: 0;
transform: translateY(-50%);
}
}
</style>
70 changes: 0 additions & 70 deletions pages/pix-site/locale-choice.vue

This file was deleted.

0 comments on commit f1fdd5c

Please sign in to comment.