	<?php
	$wrapper_attributes = get_block_wrapper_attributes(['class' => 'press-ressources alignwide']);

	$contact_persons = get_field('contact_persons', 'option');
	$ressources_graphiques = get_field('ressources_graphiques', 'option');
	?>

	<section <?php echo $wrapper_attributes; ?>>
		<div class="contact-persons">
			<div class="contact-persons__content">

				<ul class="contact-persons__list">
					<?php foreach ($contact_persons as $person) : ?>
						<?php get_template_part('template-parts/components/cards/member-card', '', array('member_id' => $person->ID)); ?>
					<?php endforeach; ?>
				</ul>
			</div>
		</div>

		<div id="press-toolbar" class="press-toolbar">
			<div role="tablist" aria-labelledby="tablist-1" class="tablist">
				<button id="tab-1" type="button" role="tab" aria-selected="true" aria-controls="tabpanel-1" data-tab="communiques">
					<img class="icon" src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-plan.svg" alt="">
					<span>Communiqués de presse</span>
				</button>


				<button id="tab-2" type="button" role="tab" aria-selected="false" aria-controls="tabpanel-2" tabindex="-1" data-tab="ressources-graphiques">
					<img class="icon" src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-plume.svg" alt="">
					<span>Ressources graphiques</span>
				</button>

				<button id="tab-3" type="button" role="tab" aria-selected="false" aria-controls="tabpanel-3" tabindex="-1" data-tab="presse-reviews">
					<img class="icon" src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-note-biographique.svg" alt="">
					<span>Ce que la presse dit de nous</span>
				</button>

			</div>
		</div>
		<div class="ressources-tabs-grid ressources-grid-content-wrapper" data-active-tab="communiques">
			<div class="communiques-de-presse">
				<?php
				$communiques_de_presse = get_posts(array(
					'post_type' => 'communique-presse',
					'posts_per_page' => 10,
				));

				?>
				<h2 class="communiques-de-presse__title">Nos Communiqués de presse</h2>


				<div class="communiques-de-presse__list">

					<?php foreach ($communiques_de_presse as $communique) : ?>
						<?php get_template_part('template-parts/components/cards/communique-presse-card', '', array('communique_id' => $communique->ID)); ?>

					<?php endforeach; ?>
				</div>
			</div>

			<div class="ressources-graphiques">
				<h2 class="ressources-graphiques__title">Ressources</h2>

				<ul class="contact-datas">
					<li class="contact-datas__item">
						<h3>contact direct</h3>
						<a href="mailto:info@carhop.be">info@carhop.be</a>
						<a href="tel:+3267485861">+32 67 48 58 61</a>
					</li>

					<li class="contact-datas__item">
						<h3>Adresse postale</h3>
						<p>Avenue de la Houssière, 80
							<br>7090 Braine-le-Comte
						</p>
					</li>

					<li class="contact-datas__item socials">
						<h3>Réseaux sociaux</h3>
						<?php echo carhop_display_social_links(); ?>
					</li>
				</ul>
				<h2 class="ressources-graphiques__title is-style-stroked-after">Ressources graphiques</h2>

				<?php if (isset($ressources_graphiques) && !empty($ressources_graphiques)) : ?>
					<ul class="download-list">
						<div class="list-heading" aria-hidden="true">
							<span>Type de fichier</span>
							<span>Format</span>
							<span>Poids</span>
						</div>
						<?php foreach ($ressources_graphiques as $ressource) : ?>

							<?php if (!isset($ressource['file']) || empty($ressource['file'])) continue; ?>
							<li class="download-list__item">
								<a href="<?php echo esc_url($ressource['file']['url']); ?>" download>
									<span class="file-name"><?php echo $ressource['file']['title']; ?></span>
									<span class="file-format"><?php echo $ressource['file']['subtype']; ?></span>
									<span class="file-size"><?php echo size_format($ressource['file']['filesize']); ?></span>
									<span class="download-link">Télécharger</span>
								</a>
							</li>
						<?php endforeach; ?>
						<li class="download-list__item">
							<a href="/assets/carhop-logo-couleurs.jpg" download>
								<span class="file-name">Logo CARHOP (couleurs) en JPG</span>
								<span class="file-format">JPG</span>
								<span class="file-size">124 ko</span>
								<span class="download-link">Télécharger</span>
							</a>
						</li>
					</ul>
				<?php endif; ?>


				<div class="sr-only">
					Liste des fichiers disponibles au téléchargement, avec leur format et leur poids.
				</div>

			</div>

			<?php get_template_part('template-parts/post-types/archives-presse/archives-presse-grid'); ?>

		</div>
	</section>