cosette/pages/index.vue

43 lines
1.2 KiB
Vue
Raw Normal View History

2022-08-11 09:57:51 +02:00
<script setup>
2022-08-16 00:57:18 +02:00
const page = ref(0)
let { data, refresh } = await useFetch(() => `/api/cosette?page=${page.value}`)
function next () {
page.value++
refresh()
}
function prev () {
page.value--
refresh()
}
2022-08-11 09:57:51 +02:00
</script>
<template>
<section class="bg-white py-8">
<Upload />
2022-08-16 00:57:18 +02:00
<Hero />
2022-08-15 10:35:37 +02:00
<div class="container mx-auto flex items-center flex-wrap pt-4 pb-12 px-2">
2022-08-16 00:57:18 +02:00
<p>Ci sono <strong>{{data.details.count}}</strong> cosette in tutto, sei a pagina {{data.details.page+1}} di {{data.details.n_page}}. Se vuoi puoi</p>
<a class="text-orange-700 hover:underline flex" href="#my-modal"><Icon-ic:baseline-add/> aggiungere una cosetta</a>
</div>
<div class='container mx-auto'>
<nav>
<button v-if='data.details.prev' @click='prev'>
<Icon-ic:baseline-chevron-left style='font-size: 40px'/>
</button>
<button v-if='data.details.next' @click='next'>
<Icon-ic:baseline-chevron-right style='font-size: 40px'/>
</button>
2022-08-11 09:57:51 +02:00
</nav>
2022-08-16 00:57:18 +02:00
<div class="md:p-5 p-1 grid grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-5">
<Cosetta v-for='cosetta in data.cosette' :key='cosetta.id' :cosetta='cosetta' />
2022-08-15 10:35:37 +02:00
</div>
2022-08-11 09:57:51 +02:00
</div>
</section>
</template>