add card and card list
This commit is contained in:
parent
6446e5cee3
commit
529e1446ee
@ -1,10 +1,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import Header from '@/components/Header.vue'
|
import Header from '@/components/Header.vue'
|
||||||
|
import CardList from '@/components/CardList.vue'
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="mt-14 w-4/5 mx-auto bg-white h-screen rounded-xl shadow-xl"
|
class="mt-14 w-4/5 mx-auto bg-white rounded-xl shadow-xl"
|
||||||
>
|
>
|
||||||
<Header/>
|
<Header/>
|
||||||
|
|
||||||
|
<div class="p-10">
|
||||||
|
<h2 class="text-3xl font-bold mb-8">Все кроссовки</h2>
|
||||||
|
|
||||||
|
<CardList/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
39
src/components/Card.vue
Normal file
39
src/components/Card.vue
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
imageUrl: String,
|
||||||
|
title: String,
|
||||||
|
price: Number,
|
||||||
|
isAdded: Boolean,
|
||||||
|
isFavorite: Boolean,
|
||||||
|
onClickAdd: Function,
|
||||||
|
onClickFavorite: Function,
|
||||||
|
});
|
||||||
|
|
||||||
|
const formatter = new Intl.NumberFormat('ru-RU', { style: 'decimal' });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="relative border bg-white border-slate-100 rounded-3xl p-8 cursor-pointer transition hover:-translate-y-2 hover:shadow-xl">
|
||||||
|
<img
|
||||||
|
:src="isFavorite ? '/like-2.svg' : '/like-1.svg'"
|
||||||
|
alt="Like"
|
||||||
|
class="absolute top-8 left-8"
|
||||||
|
@click="onClickFavorite"
|
||||||
|
>
|
||||||
|
|
||||||
|
<img :src="imageUrl" alt="Sneaker">
|
||||||
|
<p class="mt-2">{{title}}</p>
|
||||||
|
|
||||||
|
<div class="flex justify-between mt-5">
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<span class="text-slate-400 uppercase">Цена:</span>
|
||||||
|
<b>{{formatter.format(price)}} руб.</b>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<img @click="onClickAdd" :src="isAdded ? '/checked.svg' : '/plus.svg'" alt="Add">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
23
src/components/CardList.vue
Normal file
23
src/components/CardList.vue
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<script setup>
|
||||||
|
import Card from './Card.vue'
|
||||||
|
|
||||||
|
const onClickAdd = () => {
|
||||||
|
alert('Добавлено в корзину')
|
||||||
|
}
|
||||||
|
|
||||||
|
const onClickFavorite = () => {
|
||||||
|
alert('Добавлено в Избранное')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="grid grid-cols-4 gap-5">
|
||||||
|
<Card
|
||||||
|
image-url="/sneakers/sneakers-1.jpg"
|
||||||
|
title="Мужские кроссовки Nike Blazer Mid Suede"
|
||||||
|
:price="12999"
|
||||||
|
:on-click-add="onClickAdd"
|
||||||
|
:on-click-favorite="onClickFavorite"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<header
|
<header
|
||||||
class="flex justify-between border-b border-slate-300 px-11 py-10"
|
class="flex justify-between border-b border-slate-100 px-11 py-10"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
<img src="/logo.png" alt="Logo" class="w-10">
|
<img src="/logo.png" alt="Logo" class="w-10">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user