<?php

/**
 * @see https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#render
 */
?>
<?php
$container_width = 100; // Largeur totale du conteneur en %
$gap = 20; // Gap entre les slides en pixels
$slides_per_page = $attributes['slidesPerPage'];
$slide_width = $attributes['autoWidth']
  ? (100 / $slides_per_page)
  : $attributes['slideWidth'];

$wrapper_attributes = get_block_wrapper_attributes([
  'class' => 'splide' . ($attributes['showArrows'] ? '' : ' hide-arrows'),
  'data-slides-per-page' => $attributes['slidesPerPage'],
  'data-autoplay-interval' => $attributes['autoplayInterval'],
  'data-show-arrows' => $attributes['showArrows'] ? 'true' : 'false',
  'data-auto-width' => $attributes['autoWidth'] ? 'true' : 'false',
  'data-slide-width' => $slide_width,
  'data-loop' => $attributes['loop'] ? 'true' : 'false',
  'data-show-pagination' => $attributes['showPagination'] ? 'true' : 'false',
  'data-autoplay' => $attributes['autoplay'] ? 'true' : 'false'
]);
?>
<div <?php echo $wrapper_attributes; ?>>
  <div class="splide__track">
    <div class="splide__list">
      <?php echo $content; ?>
    </div>
  </div>
</div>