Ajouter les réseaux sociaux au menu public

This commit is contained in:
Alexandre NOEL 2026-10-11 23:33:50 +02:00
commit 9e05196440
8 changed files with 67 additions and 13 deletions

View file

@ -31,10 +31,10 @@
<div class="col-lg-6">
<section class="card h-100">
<div class="card-body">
<span class="badge bg-blue-lt mb-2">1.0.0-rc.32</span>
<h3>Statistiques sur mesure</h3>
<p class="text-muted">Bilans par année, par mois ou entre deux dates, avec coûts vétérinaires et
comparaison de la période précédente.</p>
<span class="badge bg-blue-lt mb-2">1.0.0-rc.33</span>
<h3>Un site public mieux connecté</h3>
<p class="text-muted">Les réseaux sociaux renseignés par l’association rejoignent la navigation,
avec des liens discrets, sécurisés et accessibles.</p>
</div>
</section>
</div>

View file

@ -14,12 +14,7 @@ $obfuscate = static fn (string$value): string => implode('', array_reverse(mb_st
class="contact-obfuscated"><?= h($obfuscate($settings['association_email'])) ?></span></div>
<?php endif; ?></div>
<div class="social-links">
<?php $socialNetworks = [
'facebook' => ['Facebook','f'], 'instagram' => ['Instagram','◎'], 'youtube' => ['YouTube','▶'],
'tiktok' => ['TikTok','♪'], 'whatsapp' => ['WhatsApp','☎'], 'linkedin' => ['LinkedIn','in'],
'x' => ['X','𝕏'], 'snapchat' => ['Snapchat','👻'],
];
foreach ($socialNetworks as $network => [$label,$icon]):
<?php foreach ($socialNetworks as $network => [$label,$icon]):
$url = trim((string)($settings['public_site_' . $network . '_url'] ?? ''));
if ($url === '') continue; ?>
<a class="social-link social-<?= h($network) ?>" href="<?= h($url) ?>" target="_blank" rel="noopener noreferrer"><span class="social-icon" aria-hidden="true"><?= h($icon) ?></span><span><?= h($label) ?></span></a>

View file

@ -13,6 +13,11 @@ $activeSpecies = (string)($selectedSpecies ?? ($animal['species'] ?? ''));
$navClass = static fn (bool$active): string => $active ? ' class="active" aria-current="page"' : '';
$fullAddress = implode(', ', array_filter([$settings['association_address'] ?? '',trim(($settings['association_postal_code'] ?? '') . ' ' . ($settings['association_city'] ?? ''))]));
$hasContactMap = $activePage === 'contact' && is_numeric($settings['association_latitude'] ?? null) && is_numeric($settings['association_longitude'] ?? null);
$socialNetworks = [
'facebook' => ['Facebook','f'], 'instagram' => ['Instagram','◎'], 'youtube' => ['YouTube','▶'],
'tiktok' => ['TikTok','♪'], 'whatsapp' => ['WhatsApp','☎'], 'linkedin' => ['LinkedIn','in'],
'x' => ['X','𝕏'], 'snapchat' => ['Snapchat','👻'],
];
if (!function_exists('public_age')) {
function public_age(array$a): string
{
@ -170,6 +175,32 @@ if (!function_exists('public_age')) {
color: var(--accent-dark)
}
.nav .nav-social-link {
width: 36px;
height: 36px;
padding: 0;
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 36px;
color: #fff;
font-size: .9rem;
font-weight: 800;
line-height: 1;
box-shadow: 0 3px 9px rgba(0, 0, 0, .12)
}
.nav .nav-social-link:hover,
.nav .nav-social-link:focus-visible {
color: #fff;
filter: brightness(.9);
transform: translateY(-1px)
}
.nav .nav-social-snapchat,
.nav .nav-social-snapchat:hover,
.nav .nav-social-snapchat:focus-visible { color: #111 }
.nav a.active {
font-weight: 800
}
@ -493,7 +524,12 @@ if (!function_exists('public_age')) {
<a<?= $navClass($activePage === 'donation') ?> href="<?= h($siteUrl('donation')) ?>">
<?= h(t('public_site.donation')) ?></a>
<a<?= $navClass($activePage === 'contact') ?> href="<?= h($siteUrl('contact')) ?>">
<?= h(t('public_site.contact')) ?></a>
<?= h(t('public_site.contact')) ?></a><?php foreach ($socialNetworks as $network => [$label,$icon]):
$socialUrl = trim((string)($settings['public_site_' . $network . '_url'] ?? ''));
if ($socialUrl === '') continue; ?>
<a class="nav-social-link nav-social-<?= h($network) ?> social-<?= h($network) ?>"
href="<?= h($socialUrl) ?>" target="_blank" rel="noopener noreferrer"
aria-label="<?= h($label) ?>" title="<?= h($label) ?>"><span aria-hidden="true"><?= h($icon) ?></span></a><?php endforeach; ?>
</nav>
</div>
</header>