Ajouter les réseaux sociaux au menu public
This commit is contained in:
parent
86642095cd
commit
9e05196440
8 changed files with 67 additions and 13 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue