traxxx-web/components/entities/tile.vue

75 lines
1.3 KiB
Vue

<template>
<a
:href="`/${entity.type}/${entity.slug}`"
class="entity nolink"
>
<img
v-if="entity.hasLogo"
:src="entity.type === 'network' || entity.isIndependent || !entity.parent
? `/logos/${entity.slug}/thumbs/network.png`
: `/logos/${entity.parent.slug}/thumbs/${entity.slug}.png`"
:alt="entity.name"
loading="lazy"
class="logo"
>
<span v-else>{{ entity.name }}</span>
<Icon
v-if="showNetworkSymbol && entity.type === 'network'"
icon="device_hub"
/>
</a>
</template>
<script setup>
defineProps({
entity: {
type: Object,
default: null,
},
showNetworkSymbol: {
type: Boolean,
default: true,
},
});
</script>
<style scoped>
.entity {
width: 15rem;
height: 6rem;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
padding: 1rem;
border-radius: .5rem;
position: relative;
background: var(--shadow-strong-30);
color: var(--text-light);
font-size: 1.25rem;
font-weight: bold;
.icon {
position: absolute;
top: -.25rem;
right: -.25rem;
padding: .4rem .55rem .25rem .25rem;
border-radius: .25rem;
background: var(--highlight-weak-30);
fill: var(--text-light);
}
&:hover {
box-shadow: 0 0 3px var(--shadow);
}
}
.logo {
height: 100%;
width: 100%;
object-fit: contain;
}
</style>