<?php
$tooltipWords = $attributes['tooltipWords'];
global $post;
$thematique = get_the_terms($post->ID, 'thematiques')[0];
?>

<section id="vocabulaire-summary" class="homegrade-blocks-vocabulaire-summary">
	<h2 className="homegrade-blocks-vocabulaire-summary__title">
		<?php echo __("Vocabulaire", "homegrade-blocks") ?><?php echo $thematique->name ? " — " . $thematique->name : ""; ?>
	</h2>

	<?php foreach ($tooltipWords as $word) : ?>
		<details class="question">
			<summary>
				<?php echo $word['tooltipText']; ?>
				<div class="open-close-icon">
					<img src="<?php echo  plugins_url('/', dirname(__FILE__)) . 'src/img/chevron_down.svg' ?>" class="open-close-cta" alt="" />
				</div>
			</summary>
			<div class="homegrade-blocks-vocabulaire-summary__content-wrapper">
				<p class="homegrade-blocks-vocabulaire-summary__content">
					<?php echo $word['tooltipDefinition']; ?>
				</p>
			</div>
		</details>
	<?php endforeach; ?>
</section>