<template>
    <router-link
        :to="{ name: 'tag', params: { tagSlug: tag.slug } }"
        :title="tag.name"
        class="tile"
    >
        <img
            v-if="tag.poster"
            :src="`/img/${tag.poster.thumbnail}`"
            :alt="tag.name"
            class="poster"
        >

        <span class="title">{{ tag.name }}</span>
    </router-link>
</template>

<script>
export default {
    props: {
        tag: {
            type: Object,
            default: null,
        },
    },
};
</script>

<style lang="scss" scoped>
@import 'theme';

.tile {
    color: $text;
    background: $background;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    box-shadow: 0 0 3px rgba(0, 0, 0, .25);
    text-align: center;
    text-decoration: none;
}

.poster {
    width: 100%;
    height: 14rem;
    object-fit: cover;
}

.title {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: .5rem 1rem;
    font-weight: bold;
    text-transform: capitalize;
}
</style>
