70 lines
No EOL
1.3 KiB
Vue
70 lines
No EOL
1.3 KiB
Vue
<template>
|
|
<nuxt-link-locale
|
|
class="card"
|
|
:to="`/catalog/${category.slug}`"
|
|
>
|
|
<nuxt-img
|
|
v-if="category.image"
|
|
format="webp"
|
|
densities="x1"
|
|
:src="category.image"
|
|
:alt="category.name"
|
|
class="card__image"
|
|
loading="lazy"
|
|
/>
|
|
<div class="card__image-placeholder" v-else />
|
|
<p>{{ category.name }}</p>
|
|
</nuxt-link-locale>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type {ICategory} from '@types';
|
|
|
|
const props = defineProps<{
|
|
category: ICategory;
|
|
}>();
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.card {
|
|
cursor: pointer;
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 20px;
|
|
background-color: $white;
|
|
border-radius: 8px;
|
|
border: 1px solid #e5e7eb;
|
|
height: 100%;
|
|
padding: 23px;
|
|
transition: 0.2s;
|
|
|
|
@include hover {
|
|
box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.3);
|
|
border-color: #505052;
|
|
}
|
|
|
|
&__image {
|
|
width: 100%;
|
|
aspect-ratio: 1;
|
|
object-fit: contain;
|
|
object-position: center;
|
|
|
|
&-placeholder {
|
|
width: 100%;
|
|
aspect-ratio: 1;
|
|
background-color: $accentLight;
|
|
border-radius: $default_border_radius;
|
|
}
|
|
}
|
|
|
|
& p {
|
|
color: #1a1a1a;
|
|
text-align: center;
|
|
font-size: 16px;
|
|
font-weight: 500;
|
|
letter-spacing: -0.5px;
|
|
}
|
|
}
|
|
</style> |