<div class="mx-8 md:mx-4 flex flex-col">
    <div class="flex flex-col mb-12">
        <h4 class="text-base not-italic font-medium leading-6 text-gray-600 mb-4"> FILTER PARTNERS BY</h4>
        <a id="all" class="mb-2 text-black font-normal" href="/partners">All</a>
        {% set taxonomy = get_taxonomy(kind="partners-category") %}
        {% set categories = taxonomy.items %}
        {% for category in categories %}
        {% set path = category.name | slugify %}
        {% set fullpath = "/partners-category/" ~ path %}
        <a id="{{path}}" class="mb-2 text-black font-normal" href={{fullpath}}> {{category.name}} </a>
        {% endfor %}
    </div>
</div>

<script>
    function setActiveCategory() {
        let activeCategory = window.location.pathname.split("/")[2]
        if (typeof activeCategory === "undefined") { activeLink = document.getElementById("all") }
        else { activeLink = document.getElementById(activeCategory) }
        activeLink.className = activeLink.className.replace("text-black font-normal", "text-black font-semibold");
    }

    setActiveCategory()
</script>