refactor: improve empty cart

This commit is contained in:
Sergey Krylov 2025-01-27 07:11:15 +03:00
parent f05130e52c
commit 7f2d0ccc9d
2 changed files with 40 additions and 3 deletions

View File

@ -3,6 +3,7 @@
import CartItemList from '@/components/CartItemList.vue' import CartItemList from '@/components/CartItemList.vue'
import { inject, onMounted, onUnmounted } from 'vue' import { inject, onMounted, onUnmounted } from 'vue'
import { decimalFormatter } from '@/utils/helpers.js' import { decimalFormatter } from '@/utils/helpers.js'
import InfoBlock from '@/components/InfoBlock.vue'
const { const {
closeDrawer, closeDrawer,
@ -66,9 +67,15 @@
</div> </div>
</div> </div>
<h2 v-else class="text-lg font-bold text-center mt-10 text-slate-500"> <InfoBlock
В корзине нет товаров v-else
</h2> title="Корзина пуста"
description="Добавьте хотябы одну пару кроссовок, чтобы сделать заказ"
image-url="/package-icon.png"
/>
<!-- <h2 v-else class="text-lg font-bold text-center mt-10 text-slate-500">-->
<!-- В корзине нет товаров-->
<!-- </h2>-->
</div> </div>
</template> </template>

View File

@ -0,0 +1,30 @@
<script setup>
defineProps({
title: String,
description: String,
imageUrl: String
})
</script>
<template>
<div class="flex flex-col items-center text-center justify-center w-72 mx-auto h-full">
<img
width="70"
:src="imageUrl"
alt="Info image"
>
<h2
class="mt-4 text-2xl font-medium"
>
{{title}}
</h2>
<p
class="text-gray-400 mt-2"
>
{{ description }}
</p>
</div>
</template>