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

34 lines
899 B
Vue
Raw Normal View History

2024-08-23 14:42:32 +02:00
<template>
2024-09-01 19:19:48 +02:00
<RouterLink v-if="link" v-slot="{ isExactActive }" :to="{ name: `admin-${activeNavigation}-${link.key}` }">
<p
class="cursor-pointer w-full px-2 py-3"
:class="
isExactActive ? 'rounded-r-lg bg-red-200 border-l-4 border-l-primary' : 'pl-3 hover:bg-red-200 rounded-lg'
"
>
{{ 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-01 19:19:48 +02:00
...mapState(useNavigationStore, ["activeNavigation"]),
2024-08-23 14:42:32 +02:00
},
});
</script>