<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="d-flex flex-row flex-wrap flex-sm-column flex-lg-row justify-content-around justify-content-sm-start justify-content-lg-between gap-2 gap-lg-3"
  >
    <Logo
      :src="logo"
      alt="Endermanch"
      title="Enderman"
      description="official website"
    />
    <ul
      class="navbar-nav flex-row flex-wrap align-items-center align-items-sm-start align-items-lg-center justify-content-center gap-3 m-2 m-sm-0 mx-lg-2 my-sm-2 my-lg-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>
