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:
isUnknown 2026-02-07 07:52:16 +01:00
parent cbe89acb21
commit a12c2df8f9
28 changed files with 1062 additions and 576 deletions

View file

@ -1,245 +1,280 @@
<script>
import { navigationStore } from '@stores/navigation'
import { localeStore } from '@stores/locale'
import { siteStore } from '@stores/site'
import { pageStore } from '@stores/page'
import { navigateTo } from '@lib/router'
$: isMenuOpen = $navigationStore.isMenuOpen
$: currentLang = $localeStore.current
$: site = $siteStore
$: logo = site.logo
$: siteTitle = site.title
$: navigation = site.navigation || []
$: languages = site.languages || []
const isMenuOpen = $derived($navigationStore.isMenuOpen)
const currentLang = $derived($localeStore.current)
const currentPage = $derived($pageStore.template || 'home')
const translations = {
expertise: { fr: 'EXPERTISE', en: 'EXPERTISE' },
games: { fr: 'GAMES', en: 'GAMES' },
play: { fr: 'PLAY', en: 'PLAY' },
about: { fr: 'À PROPOS', en: 'ABOUT' },
blog: { fr: 'BLOG', en: 'BLOG' }
}
function t(key) {
return translations[key]?.[currentLang] || translations[key]?.fr || key
}
function handleNav(path) {
navigateTo(path)
navigationStore.closeMenu()
}
function handleLanguageChange(langCode) {
// In a full implementation, this would switch to the translated URL
localeStore.setLanguage(langCode)
function toggleMenu() {
navigationStore.toggleMenu()
}
</script>
<header class="header" class:menu-open={isMenuOpen}>
<div class="header__container">
<!-- Logo -->
<a href="/" on:click|preventDefault={() => handleNav('/')} class="header__logo">
{#if logo}
<img src={logo} alt={siteTitle} />
{:else}
<span class="header__logo-text">{siteTitle}</span>
{/if}
</a>
<!-- Navigation -->
<nav class="header__nav" class:open={isMenuOpen}>
<ul class="header__nav-list">
{#each navigation as item}
{#if item.url}
<li class="header__nav-item" class:active={item.isActive}>
<a
href={item.url}
on:click|preventDefault={() => handleNav(item.url)}
>
{currentLang === 'en' ? item.label_en : item.label_fr}
</a>
</li>
{/if}
{/each}
</ul>
</nav>
<!-- Language Switcher -->
{#if languages.length > 1}
<div class="header__lang">
{#each languages as lang}
<button
class="header__lang-btn"
class:active={lang.code === currentLang}
on:click={() => handleLanguageChange(lang.code)}
>
{lang.code.toUpperCase()}
</button>
{/each}
</div>
{/if}
<!-- Mobile Menu Toggle -->
<button
class="header__toggle"
on:click={() => navigationStore.toggleMenu()}
aria-label="Menu"
>
<span></span>
<span></span>
<span></span>
</button>
<div class="navbar">
<div
class="clickable"
style="
z-index: 60;
position: absolute;
float: left;
left: 5vh;
top: 50%;
transform: translateY(-50%);
"
onclick={() => handleNav('/')}
onkeypress={(e) => e.key === 'Enter' && handleNav('/')}
role="button"
tabindex="0"
>
<img
src="/assets/img/GIF_world_game_planete.gif"
alt="World Game"
class="clickable wg-logo"
/>
</div>
</header>
<div
class="navbar-item clickable"
class:active={currentPage === 'expertise'}
style="visibility: {isMenuOpen ? 'hidden' : 'visible'};"
onclick={() => handleNav('/expertise')}
onkeypress={(e) => e.key === 'Enter' && handleNav('/expertise')}
role="button"
tabindex="0"
>
{t('expertise')}
</div>
<div
class="navbar-item clickable"
class:active={currentPage === 'portfolio'}
style="visibility: {isMenuOpen ? 'hidden' : 'visible'};"
onclick={() => handleNav('/portfolio')}
onkeypress={(e) => e.key === 'Enter' && handleNav('/portfolio')}
role="button"
tabindex="0"
>
{t('games')}
</div>
<div
class="navbar-item clickable"
class:active={currentPage === 'jouer'}
style="visibility: {isMenuOpen ? 'hidden' : 'visible'};"
onclick={() => handleNav('/jouer')}
onkeypress={(e) => e.key === 'Enter' && handleNav('/jouer')}
role="button"
tabindex="0"
>
{t('play')}
</div>
<div
class="navbar-item clickable"
class:active={currentPage === 'about'}
style="visibility: {isMenuOpen ? 'hidden' : 'visible'};"
onclick={() => handleNav('/a-propos')}
onkeypress={(e) => e.key === 'Enter' && handleNav('/a-propos')}
role="button"
tabindex="0"
>
{t('about')}
</div>
<div
class="navbar-item clickable"
class:active={currentPage === 'blog' || currentPage === 'article'}
style="visibility: {isMenuOpen ? 'hidden' : 'visible'};"
onclick={() => handleNav('/blog')}
onkeypress={(e) => e.key === 'Enter' && handleNav('/blog')}
role="button"
tabindex="0"
>
{t('blog')}
</div>
<div
class="clickable"
style="
z-index: 60;
position: absolute;
float: right;
right: 5vh;
top: 50%;
transform: translateY(-50%);
"
onclick={toggleMenu}
onkeypress={(e) => e.key === 'Enter' && toggleMenu()}
role="button"
tabindex="0"
>
<svg
width="50"
height="50"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
style="height: 4.5vh; min-height: 36px;"
>
<circle
cx="7"
cy="7"
r="2"
fill="white"
style="
transform: {isMenuOpen ? 'translate(5px, 5px) scale(0.7)' : 'translate(0px, 0px) scale(1)'};
transform-origin: center;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
"
/>
<circle
cx="17"
cy="7"
r="2"
fill="white"
style="
transform: {isMenuOpen ? 'translate(-5px, 5px) scale(0.7)' : 'translate(0px, 0px) scale(1)'};
transform-origin: center;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
"
/>
<circle
cx="7"
cy="17"
r="2"
fill="white"
style="
transform: {isMenuOpen ? 'translate(5px, -5px) scale(0.7)' : 'translate(0px, 0px) scale(1)'};
transform-origin: center;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
"
/>
<circle
cx="17"
cy="17"
r="2"
fill="white"
style="
transform: {isMenuOpen ? 'translate(-5px, -5px) scale(0.7)' : 'translate(0px, 0px) scale(1)'};
transform-origin: center;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
"
/>
<line
x1="9"
y1="9"
x2="15"
y2="15"
stroke="white"
stroke-width="2.5"
stroke-linecap="round"
style="
opacity: {isMenuOpen ? 1 : 0};
transition: opacity 0.2s ease-in-out;
transition-delay: {isMenuOpen ? '0.1s' : '0s'};
"
/>
<line
x1="15"
y1="9"
x2="9"
y2="15"
stroke="white"
stroke-width="2.5"
stroke-linecap="round"
style="
opacity: {isMenuOpen ? 1 : 0};
transition: opacity 0.2s ease-in-out;
transition-delay: {isMenuOpen ? '0.1s' : '0s'};
"
/>
</svg>
</div>
</div>
<style>
.header {
.navbar {
width: 100%;
align-items: center;
justify-self: center;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
background: rgba(0, 0, 0, 0.9);
backdrop-filter: blur(10px);
}
.header__container {
max-width: 1400px;
margin: 0 auto;
padding: 1.5rem 2rem;
display: flex;
align-items: center;
justify-content: space-between;
gap: 2rem;
}
.header__logo {
display: flex;
align-items: center;
text-decoration: none;
z-index: 1001;
}
.header__logo img {
height: 40px;
width: auto;
}
.header__logo-text {
font-size: 1.5rem;
font-weight: 700;
color: #fff;
}
.header__nav {
flex: 1;
display: flex;
justify-content: center;
}
.header__nav-list {
display: flex;
gap: 2rem;
list-style: none;
margin: 0;
padding: 0;
}
.header__nav-item a {
color: #fff;
text-decoration: none;
font-weight: 500;
z-index: 50;
font-family: "Danzza";
font-size: var(--font-size-paragraph);
font-weight: normal;
color: white;
text-align: center !important;
text-transform: uppercase;
font-size: 0.9rem;
letter-spacing: 0.05em;
padding: 2vh 0 2vh 0;
backdrop-filter: blur(0px);
transition: all 0.3s ease-in-out;
}
.navbar-item {
display: inline-block;
padding: 1vmax 2vmax;
font-weight: bold;
vertical-align: middle;
position: relative;
z-index: 5;
color: white;
transition: color 0.3s;
}
.header__nav-item a:hover,
.header__nav-item.active a {
.navbar-item.active {
color: #04fea0;
}
.header__lang {
display: flex;
gap: 0.5rem;
.navbar-item:hover {
color: #04fea0;
}
.header__lang-btn {
background: none;
border: 1px solid #fff;
color: #fff;
padding: 0.5rem 1rem;
.wg-logo {
height: 4.8vh;
pointer-events: none;
}
.clickable {
cursor: pointer;
font-size: 0.8rem;
font-weight: 600;
transition: all 0.3s;
user-select: none;
}
.header__lang-btn:hover,
.header__lang-btn.active {
background: #04fea0;
border-color: #04fea0;
color: #000;
@media screen and (max-width: 700px) {
.navbar-item {
font-size: var(--font-size-paragraph-mobile);
padding: 1vmax 1.5vmax;
}
}
.header__toggle {
display: none;
flex-direction: column;
gap: 4px;
background: none;
border: none;
cursor: pointer;
padding: 0.5rem;
z-index: 1001;
}
.header__toggle span {
width: 25px;
height: 2px;
background: #fff;
transition: all 0.3s;
}
@media (max-width: 768px) {
.header__container {
padding: 1rem;
}
.header__toggle {
display: flex;
}
.header__nav {
position: fixed;
top: 0;
right: 0;
bottom: 0;
width: 100%;
max-width: 300px;
background: rgba(0, 0, 0, 0.98);
transform: translateX(100%);
transition: transform 0.3s;
padding: 5rem 2rem 2rem;
}
.header__nav.open {
transform: translateX(0);
}
.header__nav-list {
flex-direction: column;
gap: 1.5rem;
}
.header__nav-item a {
font-size: 1.2rem;
}
.header__lang {
position: fixed;
bottom: 2rem;
right: 2rem;
}
.menu-open .header__toggle span:nth-child(1) {
transform: rotate(45deg) translate(5px, 5px);
}
.menu-open .header__toggle span:nth-child(2) {
opacity: 0;
}
.menu-open .header__toggle span:nth-child(3) {
transform: rotate(-45deg) translate(7px, -6px);
@media screen and (min-width: 701px) and (max-width: 912px) {
.navbar-item {
font-size: var(--font-size-paragraph-tablet);
padding: 1vmax 1.8vmax;
}
}
</style>