commit
9cc1530f2e
58 files changed
+5631
No files matched your search
@@ -0,0 +1,158 @@
|
||||
---
|
||||
import '../styles/global.css';
|
||||
import logo from '../assets/logo-msp.svg';
|
||||
import { getMenu, getReglages } from '../lib/site';
|
||||
|
||||
interface Props {
|
||||
titre?: string;
|
||||
description?: string;
|
||||
}
|
||||
const { titre, description } = Astro.props;
|
||||
const site = await getReglages();
|
||||
const menu = await getMenu();
|
||||
const chemin = Astro.url.pathname;
|
||||
const actif = (href: string) => (href === '/' ? chemin === '/' : chemin.startsWith(href));
|
||||
const titreComplet = titre ? `${titre} · ${site.nom_court}` : site.nom;
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>{titreComplet}</title>
|
||||
<meta name="description" content={description ?? site.description} />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="canonical" href={new URL(chemin, Astro.site)} />
|
||||
<meta property="og:title" content={titreComplet} />
|
||||
<meta property="og:locale" content="fr_FR" />
|
||||
</head>
|
||||
<body>
|
||||
<header class="entete">
|
||||
<a class="marque" href="/">
|
||||
<img src={logo.src} alt="" width="56" height="56" />
|
||||
<span set:html={site.nom.replace(' du ', '<br>du ')} />
|
||||
</a>
|
||||
<button class="burger" type="button" aria-expanded="false" aria-controls="nav-principale" aria-label="Menu">
|
||||
<svg class="ouvrir" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><path d="M4 7h16M4 12h16M4 17h16"></path></svg>
|
||||
<svg class="fermer" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"></path></svg>
|
||||
</button>
|
||||
<nav id="nav-principale" class="nav" aria-label="Navigation principale">
|
||||
{
|
||||
menu.map((item) => (
|
||||
<a href={item.href} aria-current={actif(item.href) ? 'page' : undefined}>
|
||||
{item.libelle}
|
||||
</a>
|
||||
))
|
||||
}
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<slot />
|
||||
|
||||
<footer class="pied">
|
||||
<div>
|
||||
<div class="pied-nom">{site.nom_court}</div>
|
||||
</div>
|
||||
<nav aria-label="Pied de page">
|
||||
{menu.map((item) => <a href={item.href}>{item.libelle}</a>)}
|
||||
<a href="/mentions-legales/">Mentions légales</a>
|
||||
</nav>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
const bouton = document.querySelector<HTMLButtonElement>('.burger')!;
|
||||
bouton.addEventListener('click', () => {
|
||||
const ouvert = bouton.getAttribute('aria-expanded') === 'true';
|
||||
bouton.setAttribute('aria-expanded', String(!ouvert));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<style>
|
||||
.entete {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
background: white;
|
||||
border-bottom: 1px solid oklch(90% 0.01 85);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 14px var(--gouttiere);
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
}
|
||||
.marque {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
font-family: var(--serif);
|
||||
font-weight: 700;
|
||||
font-size: 21px;
|
||||
line-height: 1.5;
|
||||
color: oklch(30% 0.06 205);
|
||||
}
|
||||
.marque img { width: 56px; height: 56px; object-fit: contain; }
|
||||
|
||||
.nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
||||
.nav a {
|
||||
padding: 10px 16px;
|
||||
border-radius: 12px;
|
||||
font-weight: 600;
|
||||
font-size: 17px;
|
||||
color: oklch(30% 0.02 240);
|
||||
}
|
||||
.nav a:hover { background: var(--creme); }
|
||||
.nav a[aria-current='page'] { background: var(--teal); color: white; }
|
||||
|
||||
.burger {
|
||||
display: none;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 16px;
|
||||
border: 1.5px solid var(--teal);
|
||||
color: var(--teal);
|
||||
background: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.burger .fermer, .burger[aria-expanded='true'] .ouvrir { display: none; }
|
||||
.burger[aria-expanded='true'] .fermer { display: block; }
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.marque { font-size: 18px; }
|
||||
.marque img { width: 48px; height: 48px; }
|
||||
.burger { display: flex; }
|
||||
.nav {
|
||||
display: none;
|
||||
flex-basis: 100%;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 4px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid oklch(92% 0.01 85);
|
||||
}
|
||||
.burger[aria-expanded='true'] + .nav { display: flex; }
|
||||
.nav a { padding: 14px 16px; font-size: 18px; }
|
||||
}
|
||||
|
||||
.pied {
|
||||
background: var(--pied);
|
||||
color: white;
|
||||
padding: 36px var(--gouttiere);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
}
|
||||
.pied-nom { font-family: var(--serif); font-weight: 700; font-size: 18px; }
|
||||
.pied nav { display: flex; gap: 12px 28px; flex-wrap: wrap; }
|
||||
.pied a { font-size: 17px; font-weight: 600; color: white; opacity: 0.9; }
|
||||
.pied a:hover { opacity: 1; text-decoration: underline; color: white; }
|
||||
.pied-contact { font-size: 15px; opacity: 0.85; margin-top: 4px; }
|
||||
.pied .pied-contact a { font-size: inherit; opacity: 1; }
|
||||
</style>
|
||||
Reference in new issue
Block a user