<script setup lang="ts">
import { storeToRefs } from 'pinia'
import { usePageStore } from '~/stores/pages'

import logo from '~/assets/images/logo.gif'

const pageStore = usePageStore()
const { pages } = storeToRefs(pageStore)

const links = toRaw(pages.value).filter((page) => page.path !== '/')
</script>

<template>
  <nav
    class="flex flex-row flex-wrap sm:flex-col lg:flex-row justify-around sm:justify-start lg:justify-between gap-2 lg:gap-3"
  >
    <Logo
      :src="logo"
      alt="Endermanch"
      title="Enderman"
      description="official website"
    />
    <ul
      class="flex flex-row flex-wrap items-center sm:items-start lg:items-center justify-center gap-3 m-2 sm:m-0 lg:mx-2 sm:my-2 lg:my-0"
    >
      <li v-for="(page, index) in links" :key="index" class="nav-item">
        <Route
          :path="page.path"
          :name="page.name"
          :icon="page.icon!.src"
          :alt="page.icon!.alt"
        />
      </li>
    </ul>
  </nav>
</template>
