<script setup>
import { useRoute } from 'vue-router';

const props = defineProps({
    routeName: {
        type: String,
        required: true,
    },
    entityId: {
        type: [String, Number],
        required: true,
    },
    url: {
        type: String,
        default: null,
    },
});

const route = useRoute();
const id = props.entityId;
</script>

<template>
    <router-link
        v-if="route?.name !== routeName"
        :to="{ name: routeName, params: { id: id } }"
        class="header link"
        :href="url"
    >
        <QIcon name="open_in_new" color="white" size="sm" />
    </router-link>
</template>
