File tree 3 files changed +14
-1
lines changed
3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
<script setup>
2
+ import heartFilled from " @/assets/heartFilled.png" ;
3
+ import heartOutline from " @/assets/heartOutline.png" ;
4
+
2
5
const props = defineProps ({ car: Object });
6
+
7
+ const favored = useState (" favored-${props.car.id}" , () => {
8
+ return false ;
9
+ });
3
10
</script >
4
11
5
12
<template >
6
13
<div
7
- class =" shadow border w-full overflow-hidden mb-5 cursor-pointer h-[200px]"
14
+ class =" relative shadow border w-full overflow-hidden mb-5 cursor-pointer h-[200px]"
8
15
>
16
+ <img
17
+ class =" absolute w-7 right-5 top-2 z-20"
18
+ :src =" favored ? heartFilled : heartOutline"
19
+ alt =" heart for adding to favorites"
20
+ @click =" favored = !favored"
21
+ />
9
22
<div class =" flex h-full" @click =" navigateTo(`/car/${car.name}-${car.id}`)" >
10
23
<NuxtImg :src =" car.url" alt =" " class =" w-[300px] h-full" />
11
24
<div class =" p-4 flex flex-col" >
You can’t perform that action at this time.
0 commit comments