ff-admin/src/components/admin/RoutingLink.vue

36 lines
915 B
Vue
Raw Normal View History

2024-08-23 14:42:32 +02:00
<template>
2024-09-02 15:57:03 +02:00
<RouterLink v-if="link" :to="{ name: `admin-${activeNavigation}-${link.key}` }">
2024-09-01 19:19:48 +02:00
<p
class="cursor-pointer w-full px-2 py-3"
:class="
2024-09-02 15:57:03 +02:00
activeLink == link.key
? 'rounded-r-lg bg-red-200 border-l-4 border-l-primary'
: 'pl-3 hover:bg-red-200 rounded-lg'
2024-09-01 19:19:48 +02:00
"
>
{{ link.title }}
</p>
</RouterLink>
2024-08-23 14:42:32 +02:00
</template>
<script setup lang="ts">
import { mapState, mapActions } from "pinia";
import { useNavigationStore, type navigationLinkModel } from "@/stores/admin/navigation";
</script>
<script lang="ts">
import { defineComponent, type PropType } from "vue";
2024-09-01 19:19:48 +02:00
import { RouterLink } from "vue-router";
2024-08-23 14:42:32 +02:00
export default defineComponent({
props: {
link: {
type: Object as PropType<navigationLinkModel>,
default: null,
},
},
computed: {
2024-09-02 15:57:03 +02:00
...mapState(useNavigationStore, ["activeLink", "activeNavigation"]),
2024-08-23 14:42:32 +02:00
},
});
</script>