Changing from WP to React | 1

This commit is contained in:
2026-02-23 19:40:30 +01:00
parent 97b818da54
commit ac95ac4fdb
10017 changed files with 4608 additions and 3419710 deletions
+42
View File
@@ -0,0 +1,42 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
}
+18
View File
@@ -0,0 +1,18 @@
import { BrowserRouter, Routes, Route } from "react-router-dom";
import { MainLayout } from "./layouts/MainLayout";
import About from "./pages/About";
function App() {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<MainLayout />}>
<Route index element={<About />} />
<Route path="a-propos" element={<About />} />
</Route>
</Routes>
</BrowserRouter>
);
}
export default App;
+80
View File
@@ -0,0 +1,80 @@
import { useState } from "react";
import { Link } from "react-router-dom";
export const Navbar = () => {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
return (
<nav className="bg-primary text-white shadow-lg z-50 relative font-semibold">
<div className="max-w-7xl mx-auto px-6 flex justify-between items-center h-20">
{/* LOGO */}
<Link to="/" className="flex items-center gap-3 group">
<div className="w-12 h-12 bg-white rounded-full flex items-center justify-center text-primary font-bold text-2xl group-hover:scale-110 transition-transform">
UA
</div>
<span className="uppercase tracking-widest text-lg">
Coeur UA PAM
</span>
</Link>
{/* MENU */}
<ul className="hidden md:flex items-center space-x-10">
{/* Dropdown Evenements */}
<li
className="relative h-20 flex items-center cursor-pointer"
onMouseEnter={() => setIsDropdownOpen(true)}
onMouseLeave={() => setIsDropdownOpen(false)}
>
<span className="hover:text-hover-nav transition-colors uppercase">
Événements
</span>
{isDropdownOpen && (
<ul className="absolute top-20 left-0 w-64 bg-primary border-t-2 border-hover-nav shadow-2xl py-2 animate-in fade-in slide-in-from-top-2">
<li>
<Link
to="/evenements/octobre-rose"
className="block px-6 py-3 hover:bg-blue-accent hover:text-hover-nav transition-colors"
>
Octobre Rose
</Link>
</li>
<li>
<Link
to="/evenements/noel"
className="block px-6 py-3 hover:bg-blue-accent hover:text-hover-nav transition-colors"
>
Noël des Ukrainiens
</Link>
</li>
</ul>
)}
</li>
<li>
<Link
to="/historique"
className="hover:text-hover-nav transition-colors uppercase"
>
Historique
</Link>
</li>
<li>
<Link
to="/a-propos"
className="text-hover-nav border-b-2 border-hover-nav pb-1 uppercase"
>
À propos
</Link>
</li>
</ul>
{/* BOUTON DON (Action) */}
<button className="bg-heading hover:bg-heading-accent text-white px-6 py-2 rounded-sm transition-all shadow-md uppercase text-sm">
Soutenir
</button>
</div>
</nav>
);
};
+124
View File
@@ -0,0 +1,124 @@
import React, { useEffect, useRef, useState } from "react";
import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { useGSAP } from "@gsap/react";
gsap.registerPlugin(ScrollTrigger);
interface SplitTextProps {
text: string;
className?: string;
delay?: number;
duration?: number;
ease?: string;
// On retire splitType s'il n'est pas utilisé pour éviter le warning "unused"
from?: gsap.TweenVars;
to?: gsap.TweenVars;
threshold?: number;
rootMargin?: string;
textAlign?: "left" | "center" | "right" | "justify";
tag?: keyof React.JSX.IntrinsicElements; // Correction du namespace
onLetterAnimationComplete?: () => void;
}
const SplitText: React.FC<SplitTextProps> = ({
text,
className = "",
delay = 50,
duration = 0.5,
ease = "back.out",
from = { opacity: 0, y: 40 },
to = { opacity: 1, y: 0 },
threshold = 0.1,
rootMargin = "0px",
textAlign = "left",
tag = "p",
onLetterAnimationComplete,
}) => {
// On remplace 'any' par un type générique d'élément HTML
const ref = useRef<HTMLElement>(null);
const animationCompletedRef = useRef(false);
const onCompleteRef = useRef(onLetterAnimationComplete);
const [fontsLoaded, setFontsLoaded] = useState(false);
useEffect(() => {
onCompleteRef.current = onLetterAnimationComplete;
}, [onLetterAnimationComplete]);
useEffect(() => {
let isMounted = true;
const handleLoad = () => {
if (isMounted) setFontsLoaded(true);
};
if (document.fonts.status === "loaded") {
Promise.resolve().then(handleLoad);
} else {
document.fonts.ready.then(handleLoad);
}
return () => {
isMounted = false;
};
}, []);
useGSAP(
() => {
if (!ref.current || !text || !fontsLoaded) return;
if (animationCompletedRef.current) return;
const el = ref.current;
const startPct = (1 - threshold) * 100;
const marginMatch = /^(-?\d+(?:\.\d+)?)(px|em|rem|%)?$/.exec(rootMargin);
const marginValue = marginMatch ? parseFloat(marginMatch[1]) : 0;
const marginUnit = marginMatch ? marginMatch[2] || "px" : "px";
const sign =
marginValue === 0
? ""
: marginValue < 0
? `-=${Math.abs(marginValue)}${marginUnit}`
: `+=${marginValue}${marginUnit}`;
const start = `top ${startPct}%${sign}`;
gsap.fromTo(
el,
{ ...from },
{
...to,
duration,
ease,
stagger: delay / 1000,
scrollTrigger: {
trigger: el,
start,
once: true,
},
onComplete: () => {
animationCompletedRef.current = true;
onCompleteRef.current?.();
},
},
);
},
{ dependencies: [text, fontsLoaded, delay, duration, ease], scope: ref },
);
const style: React.CSSProperties = {
textAlign,
wordWrap: "break-word",
willChange: "transform, opacity",
};
// Correction du type 'any' pour le Tag dynamique
const TagName = tag as React.ElementType;
return (
<TagName ref={ref} style={style} className={`inline-block ${className}`}>
{text}
</TagName>
);
};
export default SplitText;
+11
View File
@@ -0,0 +1,11 @@
export const SidePattern = () => (
<aside className="side-pattern-container">
<div className="side-pattern-image">
<div className="h-full w-full bg-linear-to-b from-heading/20 via-transparent to-heading/20 flex flex-col items-center py-8">
<span className="text-heading text-sm font-bold vertical-text uppercase tracking-widest opacity-50">
Solidarité • Ukraine • Pont-à-Mousson
</span>
</div>
</div>
</aside>
);
+40
View File
@@ -0,0 +1,40 @@
@import "tailwindcss";
@theme {
--color-primary: #1a247f;
--color-blue-accent: #0e1449;
--color-site-text: #242424;
--color-heading: #470b15;
--color-heading-accent: #751424;
--color-bg-1: #f7f0e5;
--color-bg-2: #f1e6d3;
--color-hover-nav: #dfbe85;
--color-bg-carousel: #d3c1a5;
}
/* On définit nos composants sans @apply sur des classes custom */
@layer components {
.side-pattern-container {
@apply w-20 md:w-32 bg-white relative overflow-hidden border-l border-gray-200 shadow-inner shrink-0;
}
/* On met le background-image directement ici sans passer par une autre classe */
.side-pattern-image {
@apply absolute inset-0 opacity-90;
background-image: url("/bandeau.jpg");
background-repeat: repeat-y;
background-size: contain;
}
.vertical-text {
writing-mode: vertical-rl;
text-orientation: mixed;
}
}
body {
@apply bg-bg-1 text-site-text;
margin: 0;
font-family:
"Montserrat", sans-serif; /* Pense à l'importer dans index.html */
}
+17
View File
@@ -0,0 +1,17 @@
import { Outlet } from "react-router-dom";
import { Navbar } from "../components/Navbar";
import { SidePattern } from "../components/SidePattern";
export const MainLayout = () => {
return (
<div className="flex flex-col min-h-screen">
<Navbar />
<div className="flex flex-1">
<main className="flex-1 p-8 md:p-16 bg-bg-1 overflow-y-auto">
<Outlet />
</main>
<SidePattern />
</div>
</div>
);
};
+10
View File
@@ -0,0 +1,10 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
+9
View File
@@ -0,0 +1,9 @@
const About = () => {
return (
<div>
<h1 className="text-5xl font-bold text-heading mb-6">À propos</h1>
<p>Contenu de l'association...</p>
</div>
);
};
export default About;