rebuild the public site on the Next.js App Router with static export, per-section SEO pages, metadata, sitemap, robots and a generated OG image add full-screen scroll-snap regions, staged scroll reveals, a hash-free tab navigation with a sliding indicator and region-by-region menu scrolling replace the theme text toggle with animated sun/moon icons restructure the CRM API into config, middleware, models, routes, services and utils layers redesign the CRM shell with a single surface, tab rail, full-width blurred DataTable, record dialogs and mask-based icons update Docker/Nginx publishing, Makefile targets, shared UI polish and docs Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import { useLanguage } from "../contexts/LanguageContext";
|
||||
import { Section, SectionHeading } from "./Section";
|
||||
|
||||
/** Présentation, réutilisée seule (`/about`) ou avec Stack (accueil). */
|
||||
export const AboutContent = () => {
|
||||
const { t } = useLanguage();
|
||||
|
||||
return (
|
||||
<>
|
||||
<SectionHeading title={t("about.title")} className="mb-6" />
|
||||
<p
|
||||
data-reveal
|
||||
data-reveal-delay="0.15"
|
||||
className="max-w-2xl text-base leading-relaxed text-muted-foreground sm:text-lg"
|
||||
>
|
||||
{t("about.body")}
|
||||
</p>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export const About = () => (
|
||||
<Section id="about">
|
||||
<AboutContent />
|
||||
</Section>
|
||||
);
|
||||
@@ -0,0 +1,49 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { cn } from "@cohaise/ui";
|
||||
import { scrollToSection } from "../lib/gsap";
|
||||
|
||||
export const BackToTop = () => {
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const onScroll = () => setVisible(window.scrollY > 400);
|
||||
onScroll();
|
||||
window.addEventListener("scroll", onScroll, { passive: true });
|
||||
return () => window.removeEventListener("scroll", onScroll);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => scrollToSection("#top")}
|
||||
aria-label="Retour en haut"
|
||||
title="Retour en haut"
|
||||
className={cn(
|
||||
"glass group fixed bottom-6 right-6 z-50 flex size-11 items-center justify-center rounded-full border border-border/60 text-foreground shadow-md transition-all duration-base",
|
||||
"hover:-translate-y-0.5 hover:border-accent/70 hover:text-accent hover:shadow-lg hover:ring-2 hover:ring-accent/20",
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
||||
"active:translate-y-0",
|
||||
visible
|
||||
? "translate-y-0 opacity-100"
|
||||
: "pointer-events-none translate-y-3 opacity-0",
|
||||
)}
|
||||
>
|
||||
<svg
|
||||
className="transition-transform duration-base group-hover:-translate-y-0.5"
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M12 19V5M5 12l7-7 7 7" />
|
||||
</svg>
|
||||
</button>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
// Le fond WebGL (topographie) est lourd : chargé à la demande, jamais côté
|
||||
// serveur. Il vit en position fixed (z-0) : seul le contenu (z-10) défile.
|
||||
const Topography = dynamic(() => import("./background/Topography"), {
|
||||
ssr: false,
|
||||
loading: () => null,
|
||||
});
|
||||
|
||||
export const Background = () => (
|
||||
<div className="pointer-events-none fixed inset-0 z-0" aria-hidden="true">
|
||||
<Topography color="#ff5252" opacity={0.5} speed={0.22} clickEffect="none" />
|
||||
</div>
|
||||
);
|
||||
@@ -0,0 +1,157 @@
|
||||
"use client";
|
||||
|
||||
import { useState, type FormEvent } from "react";
|
||||
import { Input } from "@cohaise/ui";
|
||||
import { useLanguage } from "../contexts/LanguageContext";
|
||||
import { LEADS_ENDPOINT } from "../lib/api";
|
||||
import { Section, SectionHeading } from "./Section";
|
||||
|
||||
type Status = "idle" | "sending" | "success" | "error";
|
||||
|
||||
const text = (value: FormDataEntryValue | null): string =>
|
||||
String(value ?? "").trim();
|
||||
|
||||
export const Contact = () => {
|
||||
const { t } = useLanguage();
|
||||
const [status, setStatus] = useState<Status>("idle");
|
||||
|
||||
const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
const data = new FormData(form);
|
||||
|
||||
const payload = {
|
||||
firstName: text(data.get("firstName")),
|
||||
lastName: text(data.get("lastName")),
|
||||
email: text(data.get("email")),
|
||||
organization: text(data.get("organization")) || null,
|
||||
phone: text(data.get("phone")) || null,
|
||||
message: text(data.get("message")),
|
||||
website: text(data.get("website")),
|
||||
};
|
||||
|
||||
if (!payload.firstName || !payload.lastName || !payload.email) {
|
||||
setStatus("error");
|
||||
return;
|
||||
}
|
||||
|
||||
setStatus("sending");
|
||||
try {
|
||||
const response = await fetch(LEADS_ENDPOINT, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
if (!response.ok) throw new Error("request failed");
|
||||
setStatus("success");
|
||||
form.reset();
|
||||
} catch {
|
||||
setStatus("error");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Section id="contact">
|
||||
<SectionHeading
|
||||
title={t("contact.title")}
|
||||
subtitle={t("contact.subtitle")}
|
||||
/>
|
||||
|
||||
<form
|
||||
onSubmit={(event) => void handleSubmit(event)}
|
||||
className="glass max-w-2xl rounded-lg border border-border/60 p-5 sm:p-6"
|
||||
data-reveal
|
||||
data-reveal-delay="0.1"
|
||||
noValidate
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
name="website"
|
||||
tabIndex={-1}
|
||||
autoComplete="off"
|
||||
aria-hidden="true"
|
||||
className="absolute -left-[9999px] h-px w-px opacity-0"
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<Input
|
||||
name="firstName"
|
||||
label={t("contact.firstName")}
|
||||
required
|
||||
autoComplete="given-name"
|
||||
/>
|
||||
<Input
|
||||
name="lastName"
|
||||
label={t("contact.lastName")}
|
||||
required
|
||||
autoComplete="family-name"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-3 grid grid-cols-2 gap-3">
|
||||
<Input
|
||||
name="organization"
|
||||
label={t("contact.company")}
|
||||
autoComplete="organization"
|
||||
/>
|
||||
<Input
|
||||
name="phone"
|
||||
label={t("contact.phone")}
|
||||
type="tel"
|
||||
autoComplete="tel"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-3">
|
||||
<Input
|
||||
name="email"
|
||||
label={t("contact.email")}
|
||||
type="email"
|
||||
required
|
||||
autoComplete="email"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-3 flex flex-col gap-1.5">
|
||||
<label
|
||||
htmlFor="message"
|
||||
className="font-display text-[0.6875rem] font-semibold uppercase tracking-label text-foreground"
|
||||
>
|
||||
{t("contact.message")}
|
||||
</label>
|
||||
<textarea
|
||||
id="message"
|
||||
name="message"
|
||||
rows={4}
|
||||
required
|
||||
className="w-full rounded-sm border border-border-control bg-surface px-3 py-2.5 text-sm text-foreground placeholder:text-subtle-foreground transition-[border-color,box-shadow] duration-fast focus-visible:border-border-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-5 flex flex-wrap items-center gap-4">
|
||||
<button
|
||||
type="submit"
|
||||
disabled={status === "sending"}
|
||||
className="inline-flex h-12 items-center gap-2.5 rounded-lg bg-primary px-6 font-display text-sm font-semibold uppercase tracking-label text-primary-foreground transition-colors hover:bg-primary-hover disabled:pointer-events-none disabled:opacity-50"
|
||||
>
|
||||
{status === "sending"
|
||||
? t("contact.sending")
|
||||
: t("contact.submit")}
|
||||
</button>
|
||||
|
||||
{status === "success" ? (
|
||||
<p className="text-sm text-success" role="status">
|
||||
{t("contact.success")}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
{status === "error" ? (
|
||||
<p className="text-sm text-destructive" role="alert">
|
||||
{t("contact.error")}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
</form>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,110 @@
|
||||
import { cn } from "@cohaise/ui";
|
||||
import type { DemoVariant } from "../data/demos";
|
||||
|
||||
const Bar = ({ className }: { className?: string }) => (
|
||||
<span className={cn("block rounded-full bg-surface-hover", className)} aria-hidden="true" />
|
||||
);
|
||||
|
||||
const Dot = ({ className }: { className?: string }) => (
|
||||
<span className={cn("block rounded-full bg-surface-hover", className)} aria-hidden="true" />
|
||||
);
|
||||
|
||||
/** Mini-interface neutre, dessinée en CSS : aucune capture, aucun logo, aucune marque. */
|
||||
export const DemoMockup = ({ variant }: { variant: DemoVariant }) => (
|
||||
<div className="relative aspect-[16/9] w-full overflow-hidden border-b border-border/60 bg-surface-sunken p-3 sm:p-4">
|
||||
<div className="flex h-full flex-col">
|
||||
<div className="mb-3 flex items-center gap-1.5" aria-hidden="true">
|
||||
<Dot className="size-2 bg-border-control" />
|
||||
<Dot className="size-2 bg-border-control" />
|
||||
<Dot className="size-2 bg-accent-graphic" />
|
||||
<span className="ml-auto h-2 w-24 rounded-full bg-surface-hover" />
|
||||
</div>
|
||||
{variant === "crm" ? <CrmMock /> : variant === "inventory" ? <InventoryMock /> : <LeaderboardMock />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const CrmMock = () => (
|
||||
<div className="flex min-h-0 flex-1 gap-3">
|
||||
<div className="flex w-14 shrink-0 flex-col gap-2 rounded-md border border-border/50 bg-surface/50 p-2" aria-hidden="true">
|
||||
<span className="h-1.5 w-6 rounded-full bg-accent-graphic" />
|
||||
<Bar className="h-1.5 w-9" />
|
||||
<Bar className="h-1.5 w-9" />
|
||||
<Bar className="h-1.5 w-7" />
|
||||
<div className="mt-auto" />
|
||||
<Bar className="h-1.5 w-6" />
|
||||
</div>
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-3">
|
||||
<div className="grid shrink-0 grid-cols-3 gap-2" aria-hidden="true">
|
||||
{[0, 1, 2].map((index) => (
|
||||
<div key={index} className="flex flex-col gap-1.5 rounded-md border border-border/50 bg-surface/50 p-2">
|
||||
<Bar className="h-1.5 w-8" />
|
||||
<span className="h-3 w-7 rounded-sm bg-accent-graphic/70" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="flex min-h-0 flex-1 flex-col gap-2.5 rounded-md border border-border/50 bg-surface/50 p-2.5" aria-hidden="true">
|
||||
{[0, 1, 2, 3].map((index) => (
|
||||
<div key={index} className="flex items-center gap-2">
|
||||
<Dot className="size-3.5 shrink-0" />
|
||||
<Bar className="h-2 w-1/2" />
|
||||
<Bar className={cn("ml-auto h-1.5 w-9 rounded-full", index % 2 === 0 ? "bg-accent-graphic/50" : "bg-surface-hover")} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const InventoryMock = () => (
|
||||
<div className="flex min-h-0 flex-1 flex-col gap-3">
|
||||
<div className="flex shrink-0 items-center gap-2" aria-hidden="true">
|
||||
<span className="h-5 w-28 rounded-sm border border-border/50 bg-surface/50" />
|
||||
<span className="ml-auto h-5 w-16 rounded-sm bg-accent-graphic/70" />
|
||||
</div>
|
||||
<div className="flex min-h-0 flex-1 gap-3">
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-2.5 rounded-md border border-border/50 bg-surface/50 p-2.5" aria-hidden="true">
|
||||
{[0, 1, 2, 3, 4].map((index) => (
|
||||
<div key={index} className="flex items-center gap-2">
|
||||
<span className="size-3.5 shrink-0 rounded-sm bg-surface-hover" />
|
||||
<Bar className="h-2 w-2/5" />
|
||||
<Bar className="ml-auto h-2 w-14" />
|
||||
<Bar className="h-1.5 w-8 rounded-full bg-accent-graphic/50" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="flex w-16 shrink-0 flex-col justify-end gap-1.5 rounded-md border border-border/50 bg-surface/50 p-2" aria-hidden="true">
|
||||
{["h-1/3", "h-2/3", "h-1/2", "h-4/5"].map((height, index) => (
|
||||
<span key={index} className={cn("w-full rounded-sm", height, index === 3 ? "bg-accent-graphic/70" : "bg-surface-hover")} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const LeaderboardMock = () => (
|
||||
<div className="flex min-h-0 flex-1 gap-3">
|
||||
<div className="flex w-2/5 shrink-0 flex-col justify-end gap-2" aria-hidden="true">
|
||||
{[
|
||||
{ label: "h-1/2", accent: true },
|
||||
{ label: "h-4/5", accent: false },
|
||||
{ label: "h-2/3", accent: false },
|
||||
].map((item, index) => (
|
||||
<div key={index} className="flex items-end justify-center gap-1">
|
||||
<span className={cn("w-full rounded-md", item.label, item.accent ? "bg-accent-graphic" : "bg-surface-hover")} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-2.5 rounded-md border border-border/50 bg-surface/50 p-2.5" aria-hidden="true">
|
||||
{[0, 1, 2, 3].map((index) => (
|
||||
<div key={index} className="flex items-center gap-2">
|
||||
<Dot className="size-3.5 shrink-0 rounded-full bg-accent-graphic/70" />
|
||||
<Bar className="h-2 w-1/3" />
|
||||
<div className="ml-auto h-1.5 w-24 overflow-hidden rounded-full bg-surface-hover">
|
||||
<span className={cn("block h-full rounded-full bg-accent-graphic/60", index === 0 ? "w-4/5" : index === 1 ? "w-3/5" : index === 2 ? "w-2/5" : "w-1/4")} />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -0,0 +1,66 @@
|
||||
"use client";
|
||||
|
||||
import { useLanguage } from "../contexts/LanguageContext";
|
||||
import type { Demo } from "../data/demos";
|
||||
import { DemoMockup } from "./DemoMockup";
|
||||
import { Section, SectionHeading } from "./Section";
|
||||
|
||||
export const Demos = ({ demos }: { demos: Demo[] }) => {
|
||||
const { t, pick } = useLanguage();
|
||||
|
||||
return (
|
||||
<Section id="demos">
|
||||
<SectionHeading title={t("demos.title")} subtitle={t("demos.subtitle")} />
|
||||
|
||||
{/*
|
||||
Sur mobile, les cartes défilent horizontalement : la région garde la
|
||||
hauteur d'un écran au lieu d'empiler trois blocs. Dès `md`, on retrouve
|
||||
la grille de trois colonnes.
|
||||
*/}
|
||||
<div className="-mx-4 flex snap-x snap-mandatory gap-4 overflow-x-auto px-4 pb-2 [scrollbar-width:none] sm:-mx-6 sm:px-6 md:mx-0 md:grid md:grid-cols-3 md:gap-6 md:overflow-visible md:px-0 md:pb-0">
|
||||
{demos.map((demo, index) => (
|
||||
<article
|
||||
key={demo.slug}
|
||||
data-reveal
|
||||
data-reveal-delay={String(index * 0.08)}
|
||||
className="glass flex w-[82%] max-w-xs shrink-0 snap-center flex-col overflow-hidden rounded-lg border border-border/60 shadow-sm md:w-auto md:max-w-none md:snap-align-none"
|
||||
>
|
||||
<DemoMockup variant={demo.mockup} />
|
||||
|
||||
<div className="flex flex-1 flex-col gap-3 p-4 sm:p-5">
|
||||
<span className="font-display text-[0.625rem] font-semibold uppercase tracking-label text-accent-graphic">
|
||||
{pick(demo.category)}
|
||||
</span>
|
||||
<h3 className="font-display text-lg font-bold uppercase tracking-display">
|
||||
{demo.title}
|
||||
</h3>
|
||||
<p className="line-clamp-3 text-sm leading-relaxed text-muted-foreground">
|
||||
{pick(demo.description)}
|
||||
</p>
|
||||
|
||||
<ul className="flex flex-wrap gap-2">
|
||||
{demo.tech.map((name) => (
|
||||
<li
|
||||
key={name}
|
||||
className="rounded-full border border-border/60 px-2.5 py-1 text-[0.625rem] uppercase tracking-label text-subtle-foreground"
|
||||
>
|
||||
{name}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
<a
|
||||
href={demo.href}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
className="mt-auto inline-flex items-center gap-1.5 pt-1 font-display text-xs font-semibold uppercase tracking-label text-foreground transition-colors hover:text-accent"
|
||||
>
|
||||
{t("demos.source")} <span aria-hidden="true">↗</span>
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { useLanguage } from "../contexts/LanguageContext";
|
||||
|
||||
const year = new Date().getFullYear();
|
||||
|
||||
export const Footer = () => {
|
||||
const { t } = useLanguage();
|
||||
|
||||
return (
|
||||
<footer className="border-t border-border/60">
|
||||
<div className="mx-auto flex w-full max-w-6xl flex-col gap-6 px-4 py-10 sm:flex-row sm:items-center sm:justify-between sm:px-6">
|
||||
<div className="flex flex-col gap-1">
|
||||
<Link
|
||||
href="/"
|
||||
className="font-logo text-sm font-bold tracking-logo text-foreground"
|
||||
>
|
||||
{t("brand.name")}
|
||||
</Link>
|
||||
<span className="text-xs text-subtle-foreground">
|
||||
{t("footer.built")}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<nav
|
||||
className="flex flex-wrap gap-x-6 gap-y-2"
|
||||
aria-label="Liens externes"
|
||||
>
|
||||
<a
|
||||
href="https://git.cohaise.dev/Esiah"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
className="text-xs uppercase tracking-label text-muted-foreground transition-colors hover:text-foreground"
|
||||
>
|
||||
Gitea (self-hosted)
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/xEsiah"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
className="text-xs uppercase tracking-label text-muted-foreground transition-colors hover:text-foreground"
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<span className="text-xs text-subtle-foreground">
|
||||
© {year} {t("brand.name")} — {t("footer.rights")}
|
||||
</span>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,253 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
type MouseEvent,
|
||||
} from "react";
|
||||
import { cn } from "@cohaise/ui";
|
||||
import { useLanguage } from "../contexts/LanguageContext";
|
||||
import {
|
||||
scrollToSection,
|
||||
setPendingSection,
|
||||
takePendingSection,
|
||||
} from "../lib/gsap";
|
||||
import { ThemeToggle } from "./ThemeToggle";
|
||||
|
||||
const links = [
|
||||
{ id: "services", path: "/services", key: "nav.services" },
|
||||
{ id: "demos", path: "/demos", key: "nav.demos" },
|
||||
{ id: "stack", path: "/stack", key: "nav.stack" },
|
||||
{ id: "about", path: "/about", key: "nav.about" },
|
||||
{ id: "contact", path: "/contact", key: "nav.contact" },
|
||||
] as const;
|
||||
|
||||
type SectionId = (typeof links)[number]["id"];
|
||||
type NavLink = (typeof links)[number];
|
||||
|
||||
const normalize = (path: string): string =>
|
||||
path !== "/" ? path.replace(/\/+$/, "") : path;
|
||||
|
||||
/*
|
||||
Durée pendant laquelle le suivi du scroll est suspendu après un clic : le
|
||||
temps que GSAP atteigne la région sans que l'indicateur ne revienne en
|
||||
arrière. Une fois le défilement fini, l'onglet cliqué reste donc actif
|
||||
(utile pour « À propos », qui partage la région de « Stack »).
|
||||
*/
|
||||
const NAV_LOCK = 1400;
|
||||
|
||||
interface Indicator {
|
||||
left: number;
|
||||
width: number;
|
||||
}
|
||||
|
||||
export const Header = () => {
|
||||
const { t, lang, setLang } = useLanguage();
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const current = normalize(pathname);
|
||||
|
||||
const navRef = useRef<HTMLDivElement>(null);
|
||||
const tabRefs = useRef(new Map<SectionId, HTMLAnchorElement>());
|
||||
const lockUntil = useRef(0);
|
||||
const [active, setActive] = useState<SectionId | null>(null);
|
||||
const [indicator, setIndicator] = useState<Indicator | null>(null);
|
||||
|
||||
/** Région qui occupe la bande centrale du viewport. */
|
||||
const regionAt = useCallback((): SectionId | null => {
|
||||
const marker = window.innerHeight * 0.45;
|
||||
let found: SectionId | null = null;
|
||||
|
||||
for (const link of links) {
|
||||
const element = document.getElementById(link.id);
|
||||
if (!element) continue;
|
||||
const rect = element.getBoundingClientRect();
|
||||
if (rect.top <= marker && rect.bottom > marker) found = link.id;
|
||||
}
|
||||
|
||||
return found;
|
||||
}, []);
|
||||
|
||||
/** Aligne la pastille glissante sur l'onglet actif. */
|
||||
const measure = useCallback(() => {
|
||||
const nav = navRef.current;
|
||||
const tab = active ? tabRefs.current.get(active) : undefined;
|
||||
if (!nav || !tab) {
|
||||
setIndicator(null);
|
||||
return;
|
||||
}
|
||||
|
||||
const navRect = nav.getBoundingClientRect();
|
||||
const tabRect = tab.getBoundingClientRect();
|
||||
setIndicator({ left: tabRect.left - navRect.left, width: tabRect.width });
|
||||
}, [active]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
measure();
|
||||
}, [measure, lang]);
|
||||
|
||||
useEffect(() => {
|
||||
const nav = navRef.current;
|
||||
if (!nav) return;
|
||||
|
||||
const observer = new ResizeObserver(measure);
|
||||
observer.observe(nav);
|
||||
|
||||
// Les libellés changent de largeur quand la police arrive.
|
||||
document.fonts?.ready.then(measure).catch(() => {});
|
||||
|
||||
return () => observer.disconnect();
|
||||
}, [measure]);
|
||||
|
||||
/*
|
||||
Sur l'accueil, l'onglet actif suit la région visible. Depuis une page SEO
|
||||
autonome, il suit le chemin courant ; au retour, la région mémorisée est
|
||||
rejointe sans passer par un `#`.
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (current !== "/") {
|
||||
const match = links.find((link) => link.path === current);
|
||||
setActive(match?.id ?? null);
|
||||
return;
|
||||
}
|
||||
|
||||
let frame = 0;
|
||||
const pending = takePendingSection();
|
||||
const target = pending
|
||||
? links.find((link) => link.id === pending)
|
||||
: undefined;
|
||||
|
||||
if (target) {
|
||||
setActive(target.id);
|
||||
lockUntil.current = Date.now() + NAV_LOCK;
|
||||
// Deux frames : laisser Next monter la page d'accueil et poser les régions.
|
||||
frame = requestAnimationFrame(() => {
|
||||
frame = requestAnimationFrame(() => {
|
||||
const duration = scrollToSection(`#${target.id}`);
|
||||
lockUntil.current = Date.now() + Math.max(NAV_LOCK, duration + 400);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
setActive(regionAt());
|
||||
}
|
||||
|
||||
const onScroll = () => {
|
||||
if (Date.now() < lockUntil.current) return;
|
||||
setActive(regionAt());
|
||||
};
|
||||
|
||||
window.addEventListener("scroll", onScroll, { passive: true });
|
||||
window.addEventListener("resize", onScroll);
|
||||
|
||||
return () => {
|
||||
cancelAnimationFrame(frame);
|
||||
window.removeEventListener("scroll", onScroll);
|
||||
window.removeEventListener("resize", onScroll);
|
||||
};
|
||||
}, [current, regionAt]);
|
||||
|
||||
const goTo = (event: MouseEvent<HTMLAnchorElement>, link: NavLink) => {
|
||||
if (current !== "/") {
|
||||
event.preventDefault();
|
||||
setPendingSection(link.id);
|
||||
router.push("/");
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
lockUntil.current = Date.now() + NAV_LOCK;
|
||||
setActive(link.id);
|
||||
const duration = scrollToSection(`#${link.id}`);
|
||||
lockUntil.current = Date.now() + Math.max(NAV_LOCK, duration + 400);
|
||||
};
|
||||
|
||||
const goHome = (event: MouseEvent<HTMLAnchorElement>) => {
|
||||
if (current !== "/") return;
|
||||
event.preventDefault();
|
||||
lockUntil.current = Date.now() + NAV_LOCK;
|
||||
setActive(null);
|
||||
const duration = scrollToSection("#top");
|
||||
lockUntil.current = Date.now() + Math.max(NAV_LOCK, duration + 400);
|
||||
};
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-40 border-b border-border/60 bg-background/70 backdrop-blur-xl">
|
||||
<div className="mx-auto flex h-16 max-w-6xl items-center gap-4 px-4 sm:px-6">
|
||||
<Link href="/" onClick={goHome} className="flex items-center gap-2.5">
|
||||
<img
|
||||
src="/images/cohaise.webp"
|
||||
alt=""
|
||||
width={28}
|
||||
height={28}
|
||||
className="size-7 object-contain"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="font-logo text-sm font-bold tracking-logo text-foreground">
|
||||
{t("brand.name")}
|
||||
</span>
|
||||
</Link>
|
||||
|
||||
<nav className="ml-auto hidden md:flex" aria-label="Navigation">
|
||||
<div
|
||||
ref={navRef}
|
||||
className="relative flex items-center gap-0.5 rounded-full border border-border/70 bg-surface/50 p-1 backdrop-blur-md"
|
||||
>
|
||||
{/* Pastille unique qui glisse d'un onglet à l'autre. */}
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={cn(
|
||||
"pointer-events-none absolute bottom-1 left-0 top-1 z-0 rounded-full bg-accent/15 ring-1 ring-accent/30 transition-[transform,width,opacity] duration-500 ease-out-soft",
|
||||
indicator ? "opacity-100" : "opacity-0",
|
||||
)}
|
||||
style={{
|
||||
width: indicator?.width ?? 0,
|
||||
transform: `translateX(${indicator?.left ?? 0}px)`,
|
||||
}}
|
||||
/>
|
||||
|
||||
{links.map((link) => {
|
||||
const isActive = active === link.id;
|
||||
return (
|
||||
<Link
|
||||
key={link.id}
|
||||
ref={(node) => {
|
||||
if (node) tabRefs.current.set(link.id, node);
|
||||
else tabRefs.current.delete(link.id);
|
||||
}}
|
||||
href={link.path}
|
||||
onClick={(event) => goTo(event, link)}
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
className={cn(
|
||||
"relative z-10 flex h-8 items-center rounded-full px-3.5 font-display text-[0.6875rem] font-semibold uppercase tracking-label transition-colors duration-fast",
|
||||
isActive
|
||||
? "text-accent"
|
||||
: "text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{t(link.key)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div className="flex items-center gap-2 md:ml-6">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setLang(lang === "fr" ? "en" : "fr")}
|
||||
className="inline-flex h-8 items-center justify-center rounded-full border border-border/70 bg-surface/40 px-2.5 font-display text-[0.625rem] font-semibold uppercase tracking-label text-muted-foreground transition-colors hover:border-accent/50 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-none"
|
||||
aria-label={lang === "fr" ? "Switch to English" : "Passer en français"}
|
||||
>
|
||||
{lang === "fr" ? "EN" : "FR"}
|
||||
</button>
|
||||
<ThemeToggle />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { useLanguage } from "../contexts/LanguageContext";
|
||||
import { Section } from "./Section";
|
||||
|
||||
export const Hero = () => {
|
||||
const { t } = useLanguage();
|
||||
|
||||
return (
|
||||
<Section id="hero" delay={0.05} className="items-start gap-6">
|
||||
<h1
|
||||
data-reveal
|
||||
data-reveal-delay="0.05"
|
||||
className="font-display text-5xl font-black uppercase leading-none tracking-display sm:text-7xl md:text-8xl"
|
||||
>
|
||||
{t("brand.name")}
|
||||
</h1>
|
||||
|
||||
<p
|
||||
data-reveal
|
||||
data-reveal-delay="0.1"
|
||||
className="max-w-2xl text-xl font-medium leading-relaxed text-foreground sm:text-2xl"
|
||||
>
|
||||
{t("hero.tagline")}
|
||||
</p>
|
||||
|
||||
<p
|
||||
data-reveal
|
||||
data-reveal-delay="0.15"
|
||||
className="max-w-xl text-base leading-relaxed text-muted-foreground"
|
||||
>
|
||||
{t("hero.subtitle")}
|
||||
</p>
|
||||
|
||||
<div
|
||||
data-reveal
|
||||
data-reveal-delay="0.2"
|
||||
className="mt-6 flex flex-wrap gap-3"
|
||||
>
|
||||
<Link
|
||||
href="/services"
|
||||
className="inline-flex h-12 items-center gap-2.5 rounded-lg bg-primary px-6 font-display text-sm font-semibold uppercase tracking-label text-primary-foreground transition-colors hover:bg-primary-hover"
|
||||
>
|
||||
{t("hero.primary")}
|
||||
</Link>
|
||||
<Link
|
||||
href="/contact"
|
||||
className="inline-flex h-12 items-center gap-2.5 rounded-lg border border-border-strong bg-surface px-6 font-display text-sm font-semibold uppercase tracking-label text-foreground transition-colors hover:bg-surface-hover"
|
||||
>
|
||||
{t("hero.secondary")}
|
||||
</Link>
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { useScrollReveal } from "../hooks/useScrollReveal";
|
||||
|
||||
/** Monte l'observateur d'animations d'entrée, une fois par page. */
|
||||
export const ScrollReveal = () => {
|
||||
useScrollReveal();
|
||||
return null;
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { cn } from "@cohaise/ui";
|
||||
|
||||
export interface SectionProps {
|
||||
id: string;
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
/**
|
||||
* Secondes d'attente avant de révéler la région, une fois qu'elle occupe
|
||||
* le centre de l'écran. Absent → délai par défaut de `useScrollReveal`.
|
||||
*/
|
||||
delay?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Une région = un écran. `min-h-dvh` et le scroll-snap de `globals.css`
|
||||
* garantissent qu'on ne s'arrête jamais entre deux sections ; le contenu est
|
||||
* centré verticalement et laisse respirer l'en-tête sticky en haut.
|
||||
*/
|
||||
export const Section = ({ id, children, className, delay }: SectionProps) => (
|
||||
<section
|
||||
id={id}
|
||||
data-region
|
||||
data-region-delay={delay === undefined ? undefined : String(delay)}
|
||||
className={cn(
|
||||
"relative mx-auto flex min-h-dvh w-full max-w-6xl flex-col justify-center px-4 pb-8 pt-20 sm:px-6 sm:py-16",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
|
||||
export const SectionHeading = ({
|
||||
eyebrow,
|
||||
title,
|
||||
subtitle,
|
||||
className,
|
||||
}: {
|
||||
eyebrow?: string;
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
className?: string;
|
||||
}) => (
|
||||
<div className={cn("mb-8 flex flex-col gap-3", className)} data-reveal>
|
||||
{eyebrow ? (
|
||||
<span className="font-display text-[0.625rem] font-semibold uppercase tracking-label text-accent-graphic">
|
||||
{eyebrow}
|
||||
</span>
|
||||
) : null}
|
||||
<h2 className="font-display text-3xl font-bold uppercase tracking-display sm:text-4xl">
|
||||
{title}
|
||||
</h2>
|
||||
{subtitle ? (
|
||||
<p className="max-w-2xl text-sm leading-relaxed text-muted-foreground sm:text-base">
|
||||
{subtitle}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
@@ -0,0 +1,101 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { cn } from "@cohaise/ui";
|
||||
import { useLanguage } from "../contexts/LanguageContext";
|
||||
import type { Service } from "../data/services";
|
||||
import { Section, SectionHeading } from "./Section";
|
||||
|
||||
/**
|
||||
* Services en onglets plutôt qu'en accordéon : la hauteur de la région reste
|
||||
* stable, donc le scroll-snap ne saute jamais quand on change de service.
|
||||
*/
|
||||
export const Services = ({ services }: { services: Service[] }) => {
|
||||
const { t, pick } = useLanguage();
|
||||
const [selected, setSelected] = useState(services[0]?.slug ?? null);
|
||||
const current =
|
||||
services.find((service) => service.slug === selected) ?? services[0];
|
||||
|
||||
return (
|
||||
<Section id="services">
|
||||
<SectionHeading
|
||||
title={t("services.title")}
|
||||
subtitle={t("services.subtitle")}
|
||||
/>
|
||||
|
||||
<div className="grid gap-6 md:grid-cols-[minmax(0,0.85fr)_minmax(0,1.15fr)] md:items-center md:gap-10">
|
||||
<div className="flex flex-col" data-reveal>
|
||||
{services.map((service) => {
|
||||
const active = service.slug === current?.slug;
|
||||
return (
|
||||
<button
|
||||
key={service.slug}
|
||||
type="button"
|
||||
onClick={() => setSelected(service.slug)}
|
||||
aria-pressed={active}
|
||||
className={cn(
|
||||
"group flex w-full items-center gap-3 border-b border-border/60 py-3 text-left first:border-t sm:py-4",
|
||||
active
|
||||
? "text-foreground"
|
||||
: "text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
"font-display text-xl font-bold uppercase tracking-display transition-colors sm:text-2xl md:text-3xl",
|
||||
active && "text-accent",
|
||||
)}
|
||||
>
|
||||
{pick(service.title)}
|
||||
</span>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={cn(
|
||||
"ml-auto font-display text-2xl font-light transition-transform duration-base",
|
||||
active
|
||||
? "rotate-45 text-accent"
|
||||
: "rotate-0 text-subtle-foreground",
|
||||
)}
|
||||
>
|
||||
+
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{current ? (
|
||||
<div
|
||||
data-reveal
|
||||
data-reveal-delay="0.12"
|
||||
aria-live="polite"
|
||||
className="glass flex min-h-40 flex-col gap-4 rounded-lg border border-border/60 p-4 sm:min-h-72 sm:p-5"
|
||||
>
|
||||
<img
|
||||
src={current.image}
|
||||
alt=""
|
||||
width={600}
|
||||
height={400}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="hidden aspect-[16/9] max-h-48 w-full rounded-md border border-border/60 object-cover sm:block"
|
||||
/>
|
||||
<p className="text-sm leading-relaxed text-muted-foreground sm:text-base">
|
||||
{pick(current.description)}
|
||||
</p>
|
||||
<ul className="flex flex-wrap gap-2">
|
||||
{current.tags.map((tag) => (
|
||||
<li
|
||||
key={pick(tag)}
|
||||
className="rounded-full border border-border/60 px-3 py-1 text-[0.625rem] uppercase tracking-label text-foreground transition-colors hover:bg-surface-hover sm:px-4 sm:py-1.5 sm:text-[0.6875rem]"
|
||||
>
|
||||
{pick(tag)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,110 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef } from "react";
|
||||
import { gsap, prefersReducedMotion } from "../lib/gsap";
|
||||
import { useLanguage } from "../contexts/LanguageContext";
|
||||
import { stack } from "../data/stack";
|
||||
import { Section, SectionHeading } from "./Section";
|
||||
|
||||
/** Bandeau technologique, réutilisé seul (`/stack`) ou avec About (accueil). */
|
||||
export const StackContent = () => {
|
||||
const { t } = useLanguage();
|
||||
const trackRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const track = trackRef.current;
|
||||
if (!track || prefersReducedMotion()) return;
|
||||
|
||||
const region = track.closest<HTMLElement>("[data-region]");
|
||||
|
||||
// Le bandeau ne démarre qu'une fois la région révélée : sinon les logos
|
||||
// défilent alors que le reste de Stack/About est encore masqué.
|
||||
let tween: gsap.core.Tween | undefined;
|
||||
const slow = () => {
|
||||
if (tween) gsap.to(tween, { timeScale: 0.25, duration: 0.6, overwrite: true });
|
||||
};
|
||||
const resume = () => {
|
||||
if (tween) gsap.to(tween, { timeScale: 1, duration: 0.6, overwrite: true });
|
||||
};
|
||||
|
||||
const start = () => {
|
||||
if (tween) return;
|
||||
// Deux copies rendues dans le JSX : -50 % = exactement une copie, boucle sans couture.
|
||||
tween = gsap.to(track, {
|
||||
xPercent: -50,
|
||||
duration: 36,
|
||||
ease: "none",
|
||||
repeat: -1,
|
||||
});
|
||||
track.addEventListener("mouseenter", slow);
|
||||
track.addEventListener("mouseleave", resume);
|
||||
};
|
||||
|
||||
let observer: MutationObserver | undefined;
|
||||
if (!region || region.dataset.revealed === "true") {
|
||||
start();
|
||||
} else {
|
||||
observer = new MutationObserver(() => {
|
||||
if (region.dataset.revealed !== "true") return;
|
||||
observer?.disconnect();
|
||||
observer = undefined;
|
||||
start();
|
||||
});
|
||||
observer.observe(region, {
|
||||
attributes: true,
|
||||
attributeFilter: ["data-revealed"],
|
||||
});
|
||||
}
|
||||
|
||||
return () => {
|
||||
observer?.disconnect();
|
||||
track.removeEventListener("mouseenter", slow);
|
||||
track.removeEventListener("mouseleave", resume);
|
||||
tween?.kill();
|
||||
};
|
||||
}, []);
|
||||
|
||||
const doubled = [...stack, ...stack];
|
||||
|
||||
return (
|
||||
<>
|
||||
<SectionHeading
|
||||
title={t("stack.title")}
|
||||
subtitle={t("stack.subtitle")}
|
||||
className="mb-6"
|
||||
/>
|
||||
|
||||
<div
|
||||
data-reveal
|
||||
data-reveal-delay="0.1"
|
||||
className="overflow-hidden [mask-image:linear-gradient(to_right,transparent,black_10%,black_90%,transparent)]"
|
||||
>
|
||||
<div ref={trackRef} className="flex w-max items-center gap-12">
|
||||
{doubled.map((item, index) => {
|
||||
const Icon = item.Icon;
|
||||
return (
|
||||
<span
|
||||
key={`${item.name}-${index}`}
|
||||
className="group/item flex shrink-0 items-center gap-3 whitespace-nowrap"
|
||||
>
|
||||
<Icon
|
||||
className="size-7 text-subtle-foreground transition-transform duration-300 ease-out group-hover/item:scale-125"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="font-display text-lg uppercase tracking-label text-subtle-foreground">
|
||||
{item.name}
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export const Stack = () => (
|
||||
<Section id="stack">
|
||||
<StackContent />
|
||||
</Section>
|
||||
);
|
||||
@@ -0,0 +1,20 @@
|
||||
import { AboutContent } from "./About";
|
||||
import { Section } from "./Section";
|
||||
import { StackContent } from "./Stack";
|
||||
|
||||
/**
|
||||
* Une seule région pour Stack et About : le snap ne peut donc jamais
|
||||
* s'arrêter entre les deux. Les deux blocs sont empilés et occupent toute la
|
||||
* largeur de la région.
|
||||
*/
|
||||
export const StackAbout = () => (
|
||||
<Section id="stack">
|
||||
<div className="flex w-full flex-col gap-8 sm:gap-10">
|
||||
<StackContent />
|
||||
{/* Ancre du menu : About partage la région de Stack sur l'accueil. */}
|
||||
<div id="about" className="w-full">
|
||||
<AboutContent />
|
||||
</div>
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
@@ -0,0 +1,65 @@
|
||||
"use client";
|
||||
|
||||
import { useLanguage } from "../contexts/LanguageContext";
|
||||
import { useTheme } from "../contexts/ThemeContext";
|
||||
|
||||
/**
|
||||
* Soleil et lune au trait fin, avec une étoile : la bascule de thème prend le
|
||||
* vocabulaire « spatial » du reste du site plutôt qu'un libellé texte.
|
||||
*
|
||||
* Le CSS de `globals.css` décide laquelle est visible selon `.dark` (posé avant
|
||||
* le premier rendu par le script anti-FOUC), donc aucun flash d'icône.
|
||||
*/
|
||||
const SunIcon = () => (
|
||||
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true" className="size-[18px]">
|
||||
<circle cx="12" cy="12" r="3.6" stroke="currentColor" strokeWidth="1.5" />
|
||||
<circle cx="12" cy="12" r="1" fill="currentColor" />
|
||||
<g stroke="currentColor" strokeWidth="1.5" strokeLinecap="round">
|
||||
<path d="M12 2.75v1.9M12 19.35v1.9M2.75 12h1.9M19.35 12h1.9M5.45 5.45l1.35 1.35M17.2 17.2l1.35 1.35M18.55 5.45l-1.35 1.35M6.8 17.2l-1.35 1.35" />
|
||||
</g>
|
||||
<path
|
||||
d="M19.4 2.6l.45 1.05 1.05.45-1.05.45-.45 1.05-.45-1.05-1.05-.45 1.05-.45Z"
|
||||
fill="currentColor"
|
||||
opacity=".8"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
|
||||
const MoonIcon = () => (
|
||||
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true" className="size-[18px]">
|
||||
<path
|
||||
d="M20.2 14.6A8.6 8.6 0 0 1 9.4 3.8 8.6 8.6 0 1 0 20.2 14.6Z"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1.5"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M17.6 4.1l.4.95.95.4-.95.4-.4.95-.4-.95-.95-.4.95-.4Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<circle cx="21" cy="8.6" r=".7" fill="currentColor" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const ThemeToggle = () => {
|
||||
const { t } = useLanguage();
|
||||
const { theme, toggleTheme } = useTheme();
|
||||
const label = t(theme === "dark" ? "theme.light" : "theme.dark");
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={toggleTheme}
|
||||
aria-label={label}
|
||||
title={label}
|
||||
className="group relative inline-flex h-8 w-8 items-center justify-center rounded-full border border-border/70 bg-surface/40 text-muted-foreground transition-[color,background-color,border-color,box-shadow] duration-fast ease-out-soft hover:border-accent/50 hover:bg-accent/10 hover:text-accent hover:shadow-[0_0_20px_-6px_var(--color-accent)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-none"
|
||||
>
|
||||
<span className="theme-icon theme-icon-sun absolute inset-0 flex items-center justify-center transition-[opacity,transform] duration-500 ease-out-soft">
|
||||
<SunIcon />
|
||||
</span>
|
||||
<span className="theme-icon theme-icon-moon absolute inset-0 flex items-center justify-center transition-[opacity,transform] duration-500 ease-out-soft">
|
||||
<MoonIcon />
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user