<script lang='ts'>
  import { createEventDispatcher } from "svelte";
  export let items;
  export let activeItem;
  export let size = 'medium';
  // big, medium, small

  const dispatch = createEventDispatcher();

</script>

<!-- svelte-ignore a11y-click-events-have-key-events -->
<div class="tabs" class:size={size}>
  <!-- creates a list, can be done other ways -->
  <ul>
    {#each items as item}
      <li class={size} on:click={() => dispatch('tabChange', item)}>
        <!-- the class active is attributed if the condition is met -->
        <div class:active={activeItem === item}>{item}</div>
      </li>
    {/each}
  </ul>
</div>

<style>
  /* .tabs{
    margin-bottom: 40px;
  } */
  .tab.big{
    margin-bottom: 50px;
    /* guessing at size */
  }
  .tab.medium{
    margin-bottom: 40px;
    /* the OG size */
  }
  .tab.small{
    margin-bottom: 10px;
    /* need it small */
  }
  ul{
    display: flex;
    justify-content: center;
    padding: 0;
    list-style-type: none;
  }
  li{
    /* margin: 0 16px; */
    /* font-size: 18px; */
    color: #555;
    cursor: pointer;
  }
  li.big{
    margin: 0 20px;
    font-size: 22px;
    /* guessing at size */
  }
  li.medium{
    margin: 0 16px;
    font-size: 18px;
    /* the OG size */
  }
  li.small{
    margin: 8px;
    font-size: 10px;
    /* need it small */
  }


  .active{
    color: #d91b42;
    border-bottom: 2px solid #d91b42;
    padding-bottom: 8px;
  }
</style>