<template>
  <div
    v-for="item in projectMenu"
    :key="item.label"
    class="flex flex-col justify-center items-center w-50px h-50px cursor-pointer mr-10px hover:bg-bg-tertiary rounded-4px"
    @click="handleClick(item.key)"
  >
    <div class="w-30px h-30px flex items-center justify-center">
      <img
        v-if="typeof item.img === 'string'"
        :src="item.img"
        class="w-24px h-24px"
        :alt="item.label"
      />
      <component v-else :is="item.img" size="20px"></component>
    </div>
    <div class="text-12px">{{ item.label }}</div>
  </div>
</template>

<script setup lang="ts">
import { inject } from 'vue'
import { LuHelpCircle, LuFileKey, LuInfo } from 'vue-icons-plus/lu'

const onMenuClick = inject<(menuKey: string) => void>('onMenuClick', () => {})

const projectMenu = [
  {
    key: 'lincense',
    label: '授权信息',
    img: LuFileKey
  },
  {
    key: 'help',
    label: '帮助文档',
    img: LuHelpCircle
  },
  {
    key: 'about',
    label: '关于',
    img: LuInfo
  }
]

const handleClick = (menuKey: string) => {
  onMenuClick?.(menuKey)
}
</script>

<style lang="less" scoped></style>
