-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat(frontend):Add products page
- Loading branch information
1 parent
9460f75
commit b8f8457
Showing
2 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<div class="m-14"> | ||
<div class="flex flex-col gap-4 items-center"> | ||
<h1 class="poppins font-bold w-full text-center text-[40px]">OUR <span class="text-[#EA454C]">PRODUCTS</span></h1> | ||
<div class="poppins text-center text-base font-normal text-[#6C6C6C] ">Look at our wide range of products</div> | ||
</div> | ||
<div class="flex justify-center items-center flex-col gap-8 mt-5 lg:flex-row "> | ||
<div class="flex flex-wrap justify-center gap-8 bg-red px-10 py-8"> | ||
<NuxtLink v-for="data in productlists" :to="`/products/${data.id}`" :key="data.id"> | ||
<MerchCard | ||
:title= "data.title" | ||
:type= "data.type" | ||
:imageUrl= "data.product_images" | ||
:seller = "data.seller" | ||
:price = "data.price" | ||
:description = "data.description" | ||
:colors= "data.colors" | ||
:sizes= "data.sizes" | ||
:tags = "data.tags" | ||
/> | ||
</NuxtLink> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
|
||
<script setup> | ||
import MerchCard from '@/components/MerchCard.vue'; | ||
const config = useRuntimeConfig(); | ||
const productlists = ref([]); | ||
async function fetchEventData() { | ||
try { | ||
const response = await $fetch(`${config.public.API_BASE_URL}/api/products/`); | ||
productlists.value = response.map(product => { | ||
return { | ||
...product, | ||
product_images: product.product_images.map(img => ({ | ||
...img, | ||
image: `${config.public.API_BASE_URL}${img.image}` | ||
})) | ||
}; | ||
}); | ||
} | ||
catch (error) { | ||
console.error('Error fetching event data', error); | ||
} | ||
} | ||
onMounted(() => fetchEventData()); | ||
</script> | ||
|
||
|
||
<style> | ||
.poppins { | ||
font-family: "Poppins", sans-serif; | ||
font-smooth: always; | ||
} | ||
</style> |