<?php
$post_ID = $args['post_ID'];
$card_variant = $args['card_variant'];
$post_thumbnail = $args['post_thumbnail'];
$post_title = $args['post_title'];
$post_date = $args['post_date'] ?? null;
$news_type = $args['news_type'] ?? null;
$thematique = $args['thematique'] ?? null;
$mainThematique = getMainThematique($thematique) ?? null;

?>

<div class="card-news <?php echo $card_variant ? 'card-news--' . $card_variant  : '' ?> ">
	<?php echo $post_thumbnail ?>
	<div class="card-news__inner">
		<div class="card-news__heading">
			<h3 class="card-news__title"><?php echo $post_title ?></h3>
			<?php if ($news_type) : ?>
				<p class="card-news__tag"><?php echo $news_type[0]->name ?></p>
			<?php endif; ?>
			<?php if ($thematique) : ?>
				<p class="card-news__thematique-tag card-news__thematique-tag--<?php echo $mainThematique->slug ?>"><?php echo $thematique->name ?></p>
			<?php endif; ?>
			<?php if ($post_date) : ?>
				<p class="card-news__post-date card-news__post-date"><?php echo $post_date ?></p>
			<?php endif; ?>

		</div>

		<a href=" <?php echo get_the_permalink($post_ID) ?>" class="cta cta--read-more cta--with-arrow-button cta--streched  ">
			<!-- cta-read-more -->
			<span><?php echo __("Lire l'article", 'homegrade-theme__texte-fonctionnel') ?></span>
			<span class="sr-only"> &nbsp;<?php echo $post_title ?></span>
			<img class="cta_arrow_button" src='<?php echo get_template_directory_uri() ?>/resources/img/graphic-assets/arrow-right-circle.svg' alt=''>
		</a>
	</div>

</div>