Migration vers architecture Svelte + Kirby inspirée de design-to-pack

- Mise en place de Svelte 4 avec Vite pour le frontend (SPA)
- Simplification des templates PHP (header/footer minimalistes)
- Création de templates JSON pour API (home, about, expertise, portfolio, jouer, game, blog, article, project)
- Ajout d'un controller de site pour définir genericData globalement
- Structure des stores Svelte (page, navigation, locale, site)
- Router avec navaid pour navigation SPA et interception des liens
- Composants layout (Header, Footer, Cursor) et vues de base
- Build Vite vers assets/dist/ (index.js/css)
- Header PHP détecte assets/dist pour basculer dev/prod

Architecture fonctionnelle de base établie, à améliorer et compléter.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-02-06 16:30:15 +01:00
parent c4456d587c
commit cbe89acb21
53 changed files with 3348 additions and 772 deletions

View file

@ -0,0 +1,245 @@
<script>
import { navigationStore } from '@stores/navigation'
import { localeStore } from '@stores/locale'
import { siteStore } from '@stores/site'
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 || []
function handleNav(path) {
navigateTo(path)
navigationStore.closeMenu()
}
function handleLanguageChange(langCode) {
// In a full implementation, this would switch to the translated URL
localeStore.setLanguage(langCode)
}
</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>
</header>
<style>
.header {
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;
text-transform: uppercase;
font-size: 0.9rem;
letter-spacing: 0.05em;
transition: color 0.3s;
}
.header__nav-item a:hover,
.header__nav-item.active a {
color: #04fea0;
}
.header__lang {
display: flex;
gap: 0.5rem;
}
.header__lang-btn {
background: none;
border: 1px solid #fff;
color: #fff;
padding: 0.5rem 1rem;
cursor: pointer;
font-size: 0.8rem;
font-weight: 600;
transition: all 0.3s;
}
.header__lang-btn:hover,
.header__lang-btn.active {
background: #04fea0;
border-color: #04fea0;
color: #000;
}
.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);
}
}
</style>