Files
aranroig.com/frontend/app/pages/art/index.vue
Aran Roig 482fbffece
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 1m1s
Lazi loadin
2026-04-13 15:19:25 +02:00

73 lines
1.9 KiB
Vue

<script setup lang="ts">
import FixedLayout from '~/components/layouts/FixedLayout.vue';
import TableHeader from '~/components/parts/TableHeader.vue';
const { locale } = useI18n();
const localePath = useLocalePath()
const {data: posts} = useAsyncData('art-posts', async () =>
await queryCollection(`art`).where('path', 'LIKE', `/art/${locale.value}/%`).order('date', 'DESC').all()
, {watch: [locale, () => useRoute().path]});
</script>
<template>
<TableHeader></TableHeader>
<FixedLayout>
<Container>
<div class="grid">
<NuxtLink v-for="art in posts"
:key="art.slug"
class="selector"
:to="localePath(`/art/${art.slug}`)">
<NuxtImg
:src="art.thumb"
:alt="art.title"
class="selector-img"
width="600"
height="250"
fit="cover"
/>
<div class="overlay-text">{{ art.title }}</div>
</NuxtLink>
</div>
</Container>
</FixedLayout>
<Footer></Footer>
</template>
<style lang="scss" scoped>
.grid {
display: grid;
grid-template-columns: repeat(3, minmax(250px, 1fr));
gap: 16px;
padding: 40px 20px 40px 20px;
}
.selector {
width: 100%;
height: 250px;
border-radius: 12px;
overflow: hidden;
position: relative;
cursor: pointer;
transition: transform 0.2s ease;
display: block; /* ensures NuxtLink behaves as a block */
}
.selector:hover {
transform: scale(1.03);
}
.selector-img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.overlay-text {
position: absolute;
bottom: 10px;
left: 10px;
color: white;
font-size: 18px;
font-weight: bold;
text-shadow: 0 2px 8px rgba(0,0,0,0.7);
pointer-events: none;
}
/* ...rest unchanged */
</style>