<!-- Quick Links Section -->
<?php

require(get_theme_file_path('/includes/front-end/menu_data.php'));

$current_slug = get_post_field('post_name', get_post());
$subcategories = getSubcategoriesBySlug($menuData, $current_slug);


if (count($subcategories) > 0) { ?>

  <?php
  foreach ($subcategories as $subcategory) {

    $content = $subcategory['description'] ?? $subcategory['title']

  ?>


    <div class="px-2">
      <ul role="list" class="max-w-7xl mx-auto text-blue-500 bg-white border-blue-500 border py-4 mb-4 rounded-md">
        <li class="accordion">
          <div class="flex px-2 rounded-md justify-between">
            <div class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
              <p><?php echo $subcategory['title']; ?></p>
            </div>
            <button class="accordion-toggle">
              <i class="fas fa-chevron-down items-center ml-auto rounded-md bg-gray-900 px-2.5 py-2 text-white ring-1 ring-inset ring-gray-700" aria-hidden="true"></i>
              <i class="fas fa-times items-center ml-auto rounded-md bg-gray-900 px-3 py-2 text-white ring-1 ring-inset ring-gray-700" aria-hidden="true"></i>
            </button>
          </div>
          <ul class="accordion-content space-y-2">


            <li class="p-2">
              <a href="<?php echo get_site_url() . '/' . $current_slug . '/' . $subcategory['slug'] ?>" class="flex space-x-2 items-center"><i class="bi-caret-right-fill"></i>
                <p><?php echo $content ?></p>
              </a>
            </li>

          </ul>
        </li>
      </ul>
    </div>

<?php }
}
