Correction de redirection
This commit is contained in:
@@ -1,6 +1,20 @@
|
||||
import { Link } from 'react-router-dom'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
|
||||
export default function Footer() {
|
||||
const { pathname } = useLocation()
|
||||
const { user } = useAuth()
|
||||
const isLoggedIn = !!user
|
||||
|
||||
function FooterLink({ to, children, className=''}) {
|
||||
return pathname === to ? (
|
||||
<span className={className}>{children}</span>
|
||||
) : (
|
||||
<Link to={to} className={className}>
|
||||
{children}
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<footer className="bg-green-900 text-white">
|
||||
|
||||
@@ -11,13 +25,11 @@ export default function Footer() {
|
||||
|
||||
{/* Logo */}
|
||||
<div>
|
||||
|
||||
<Link to="/accueil">
|
||||
<FooterLink to='/accueil'>
|
||||
<h3 className="text-xl font-bold mb-3">
|
||||
Thé Tip Top
|
||||
</h3>
|
||||
</Link>
|
||||
|
||||
</FooterLink>
|
||||
|
||||
<p className="text-green-100 text-sm leading-relaxed">
|
||||
Participez au jeu-concours Thé Tip Top et tentez de gagner
|
||||
@@ -39,43 +51,44 @@ export default function Footer() {
|
||||
<ul className="space-y-3 text-green-100">
|
||||
|
||||
<li>
|
||||
<Link
|
||||
<FooterLink
|
||||
to="/accueil"
|
||||
className="hover:text-white transition"
|
||||
>
|
||||
Accueil
|
||||
</Link>
|
||||
</FooterLink>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<Link
|
||||
<FooterLink
|
||||
to="/regles-jeu"
|
||||
className="hover:text-white transition"
|
||||
>
|
||||
Règles du jeu
|
||||
</Link>
|
||||
</FooterLink>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<Link
|
||||
<li>
|
||||
<FooterLink
|
||||
to="/saisir-code-unique"
|
||||
className="hover:text-white transition"
|
||||
>
|
||||
Tester mon code
|
||||
</Link>
|
||||
</FooterLink>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<Link
|
||||
to="/inscription"
|
||||
className="hover:text-white transition"
|
||||
>
|
||||
Créer un compte
|
||||
</Link>
|
||||
</li>
|
||||
{ !isLoggedIn && (
|
||||
<li>
|
||||
<FooterLink
|
||||
to="/inscription"
|
||||
className="hover:text-white transition"
|
||||
>
|
||||
Créer un compte
|
||||
</FooterLink>
|
||||
</li>
|
||||
)}
|
||||
|
||||
</ul>
|
||||
|
||||
@@ -95,41 +108,41 @@ export default function Footer() {
|
||||
<ul className="space-y-3 text-green-100">
|
||||
|
||||
<li>
|
||||
<Link
|
||||
<FooterLink
|
||||
to="/mentions-legales"
|
||||
className="hover:text-white transition"
|
||||
>
|
||||
Mentions légales
|
||||
</Link>
|
||||
</FooterLink>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<Link
|
||||
<FooterLink
|
||||
to="/confidentialite"
|
||||
className="hover:text-white transition"
|
||||
>
|
||||
Politique de confidentialité
|
||||
</Link>
|
||||
</FooterLink>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<Link
|
||||
<li>
|
||||
<FooterLink
|
||||
to="/contact"
|
||||
className="hover:text-white transition"
|
||||
>
|
||||
Contact
|
||||
</Link>
|
||||
</FooterLink>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<Link
|
||||
<FooterLink
|
||||
to="/sitemap"
|
||||
className="hover:text-white transition"
|
||||
>
|
||||
Plan du site
|
||||
</Link>
|
||||
</FooterLink>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user