schon/storefront/components/cards/category.vue
Alexandr SaVBaD Waltz 129ad1a6fa Features: 1) Build standalone pages for search, contact, catalog, category, brand, product, and home with localized metadata and scoped styles; 2) Add extensive TypeScript definitions for API and app-level structures, including products, orders, brands, and categories; 3) Implement i18n configuration with dynamic browser language detection and fallback system;
Fixes: None;

Extra: 1) Create Pinia stores for app, user, category, and company management; 2) Add utility functions for error handling and category slug lookups; 3) Include German locale file and robots.txt for improved SEO and accessibility; 4) Add SVG assets and improve general folder structure for better maintainability.
2025-06-27 00:10:35 +03:00

67 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/index.js";
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: $default_border_radius;
border: 2px solid $accentDark;
height: 100%;
padding: 20px;
transition: 0.2s;
@include hover {
box-shadow: 0 0 30px 3px rgba($accentDark, 0.4);
}
&__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 {
text-align: center;
font-size: 18px;
font-weight: 600;
}
}
</style>