Upgrade vers Svelte 5 et reproduction de la page d'accueil
- Upgrade : Svelte 5.0.0, Vite 7.0.4, @sveltejs/vite-plugin-svelte 6.0.0 - Migration syntaxe Svelte 5 : $derived, $props(), onclick, mount() - Navbar identique au site source avec logo GIF et menu animé - Page Home avec vidéo plein écran et lignes verticales - CSS modulaire organisé en fichiers séparés (variables, fonts, layout, buttons, etc.) - Assets copiés : fonts Danzza, vidéos, icônes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
cbe89acb21
commit
a12c2df8f9
28 changed files with 1062 additions and 576 deletions
|
|
@ -1,164 +1,218 @@
|
|||
<script>
|
||||
import { onMount } from 'svelte'
|
||||
import { fade } from 'svelte/transition'
|
||||
import VideoBackground from '@components/ui/VideoBackground.svelte'
|
||||
import Button from '@components/ui/Button.svelte'
|
||||
import { localeStore } from '@stores/locale'
|
||||
import { navigateTo } from '@lib/router'
|
||||
import { pageEnter } from '@lib/animations'
|
||||
|
||||
export let data
|
||||
let { data } = $props()
|
||||
|
||||
let contentElement
|
||||
const currentLang = $derived($localeStore.current)
|
||||
|
||||
const translations = {
|
||||
homeText: {
|
||||
fr: "World Game crée des expériences gamifiées qui transforment l'engagement en résultats mesurables",
|
||||
en: "World Game creates gamified experiences that transform engagement into measurable results"
|
||||
},
|
||||
explore: {
|
||||
fr: "EXPLORER",
|
||||
en: "EXPLORE"
|
||||
}
|
||||
}
|
||||
|
||||
function t(key) {
|
||||
return translations[key]?.[currentLang] || translations[key]?.fr || ''
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (contentElement) {
|
||||
pageEnter(contentElement)
|
||||
const playVideo = async (videoId) => {
|
||||
const video = document.getElementById(videoId)
|
||||
if (video) {
|
||||
try {
|
||||
video.muted = true
|
||||
video.playsInline = true
|
||||
const playPromise = video.play()
|
||||
if (playPromise !== undefined) {
|
||||
await playPromise
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`Autoplay failed for ${videoId}:`, error)
|
||||
const playOnInteraction = () => {
|
||||
video.play().catch(e => console.log('Fallback play failed:', e))
|
||||
document.removeEventListener('click', playOnInteraction)
|
||||
document.removeEventListener('touchstart', playOnInteraction)
|
||||
}
|
||||
document.addEventListener('click', playOnInteraction)
|
||||
document.addEventListener('touchstart', playOnInteraction)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
playVideo('home-video')
|
||||
playVideo('home-video-mobile')
|
||||
}, 100)
|
||||
|
||||
return () => clearTimeout(timer)
|
||||
})
|
||||
|
||||
function handleExplore() {
|
||||
navigateTo(data?.hero?.cta_link || '/portfolio')
|
||||
navigateTo('/portfolio')
|
||||
}
|
||||
|
||||
$: hero = data?.hero || {}
|
||||
$: backgroundVideo = data?.background_video
|
||||
$: floatingBubbles = data?.floating_bubbles || []
|
||||
</script>
|
||||
|
||||
<div class="home" transition:fade>
|
||||
{#if backgroundVideo}
|
||||
<VideoBackground src={backgroundVideo} />
|
||||
{/if}
|
||||
|
||||
<div class="home__content" bind:this={contentElement}>
|
||||
<h1 class="home__title">
|
||||
{@html hero.title || 'PLAY TO ENGAGE'}
|
||||
</h1>
|
||||
|
||||
{#if hero.subtitle}
|
||||
<p class="home__subtitle">
|
||||
{@html hero.subtitle}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
{#if hero.cta_text}
|
||||
<Button on:click={handleExplore} variant="primary" size="large">
|
||||
{hero.cta_text}
|
||||
</Button>
|
||||
{/if}
|
||||
<div class="home golden-grid slide" data-anchor="HOME">
|
||||
<div style="grid-area: 1/1/span 20/span 20; filter: saturate(140%);">
|
||||
<div class="olly">
|
||||
<figure
|
||||
style="
|
||||
height: -webkit-fill-available;
|
||||
width: -webkit-fill-available;
|
||||
"
|
||||
>
|
||||
<video
|
||||
muted
|
||||
autoplay
|
||||
playsinline
|
||||
loop
|
||||
controls={false}
|
||||
preload="metadata"
|
||||
id="home-video"
|
||||
class="home-video home-video-desktop"
|
||||
style="
|
||||
object-fit: cover;
|
||||
min-height: 100%;
|
||||
min-width: 100%;
|
||||
height: -webkit-fill-available;
|
||||
width: -webkit-fill-available;
|
||||
"
|
||||
>
|
||||
<source
|
||||
src="/assets/video/Website_version.mp4"
|
||||
type="video/mp4"
|
||||
/>
|
||||
</video>
|
||||
<video
|
||||
muted
|
||||
autoplay
|
||||
playsinline
|
||||
loop
|
||||
controls={false}
|
||||
preload="metadata"
|
||||
id="home-video-mobile"
|
||||
class="home-video-mobile"
|
||||
style="
|
||||
object-fit: cover;
|
||||
min-height: 100%;
|
||||
min-width: 100%;
|
||||
height: -webkit-fill-available;
|
||||
width: -webkit-fill-available;
|
||||
"
|
||||
>
|
||||
<source
|
||||
src="/assets/video/mobile_version_texte_fixe.mp4"
|
||||
type="video/mp4"
|
||||
/>
|
||||
</video>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if floatingBubbles.length > 0}
|
||||
<div class="home__bubbles">
|
||||
{#each floatingBubbles as bubble}
|
||||
<div class="bubble bubble--{bubble.position}">
|
||||
{bubble.text}
|
||||
</div>
|
||||
{/each}
|
||||
<div class="vertical-line-start"></div>
|
||||
<div class="vertical-line-center"></div>
|
||||
<div class="vertical-line-end"></div>
|
||||
|
||||
<div
|
||||
class="home-text"
|
||||
style="z-index: 5; justify-self: center; margin-top: 6vmax;"
|
||||
>
|
||||
<h2 class="font-face-danzza-light home-subtitle">
|
||||
{t('homeText')}
|
||||
</h2>
|
||||
<div
|
||||
class="clickable button"
|
||||
style="margin: auto; margin-top: 40px;"
|
||||
onclick={handleExplore}
|
||||
onkeypress={(e) => e.key === 'Enter' && handleExplore()}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<div class="earth-icon clickable-filter-black"></div>
|
||||
<p class="clickable" style="font-family: Terminal; font-size: 1.2em;">
|
||||
{t('explore')}
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.home {
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
padding: 6rem 2rem 2rem;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.home__content {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
text-align: center;
|
||||
max-width: 1200px;
|
||||
.home-text {
|
||||
z-index: 9;
|
||||
grid-area: 9/1 / span 6 / span 20;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.home-subtitle {
|
||||
font-size: var(--font-size-subtitle);
|
||||
color: white;
|
||||
width: 30%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.home__title {
|
||||
font-size: clamp(3rem, 8vw, 8rem);
|
||||
font-family: 'Danzza', sans-serif;
|
||||
font-weight: 700;
|
||||
margin: 0 0 1.5rem;
|
||||
line-height: 1.1;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.home__title :global(.highlight) {
|
||||
color: #04fea0;
|
||||
}
|
||||
|
||||
.home__subtitle {
|
||||
font-size: clamp(1.2rem, 3vw, 2rem);
|
||||
margin: 0 0 3rem;
|
||||
opacity: 0.9;
|
||||
max-width: 800px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.home__bubbles {
|
||||
.olly {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 5;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bubble {
|
||||
.olly figure {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.home-video {
|
||||
position: absolute;
|
||||
background: rgba(4, 254, 160, 0.1);
|
||||
border: 1px solid rgba(4, 254, 160, 0.3);
|
||||
border-radius: 50%;
|
||||
padding: 1rem 1.5rem;
|
||||
font-size: 0.9rem;
|
||||
color: #04fea0;
|
||||
backdrop-filter: blur(10px);
|
||||
animation: float 6s ease-in-out infinite;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.bubble--top-left {
|
||||
top: 15%;
|
||||
left: 10%;
|
||||
.home-video-desktop {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.bubble--top-right {
|
||||
top: 20%;
|
||||
right: 15%;
|
||||
animation-delay: -2s;
|
||||
.home-video-mobile {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.bubble--bottom-left {
|
||||
bottom: 25%;
|
||||
left: 15%;
|
||||
animation-delay: -4s;
|
||||
}
|
||||
|
||||
.bubble--bottom-right {
|
||||
bottom: 20%;
|
||||
right: 10%;
|
||||
animation-delay: -3s;
|
||||
}
|
||||
|
||||
@keyframes float {
|
||||
0%, 100% {
|
||||
transform: translateY(0);
|
||||
@media screen and (max-width: 1000px) {
|
||||
.home-video-desktop {
|
||||
display: none !important;
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-20px);
|
||||
.home-video-mobile {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.home-subtitle {
|
||||
font-size: var(--font-size-subtitle-mobile);
|
||||
width: 80%;
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.home {
|
||||
padding: 5rem 1rem 2rem;
|
||||
}
|
||||
|
||||
.bubble {
|
||||
font-size: 0.7rem;
|
||||
padding: 0.75rem 1rem;
|
||||
@media screen and (min-width: 701px) and (max-width: 912px) {
|
||||
.home-subtitle {
|
||||
font-size: var(--font-size-subtitle-tablet);
|
||||
width: 70%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue