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

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

<script>
function sfw() {
    return this.$store.state.ui.sfw;
}

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

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

.tile {
    color: var(--text-light);
    background: var(--profile);
    display: flex;
    flex-direction: column;
    align-items: left;
    justify-content: flex-end;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
    box-shadow: inset 0 0 3px var(--darken);
}

.poster {
    width: 100%;
    height: 14rem;
    object-fit: cover;
    box-shadow: 0 0 3px var(--darken);
}

.title {
    display: flex;
    font-size: 1rem;
    padding: .5rem 1rem;
    font-weight: bold;
    text-transform: capitalize;
}
</style>
