2024-09-04 11:41:37 +02:00
|
|
|
<template>
|
2024-09-09 20:03:24 +02:00
|
|
|
<h1 class="sr-only">{{ data.content.title }}</h1>
|
|
|
|
|
<div class="with-sidebar">
|
2024-09-10 08:49:09 +02:00
|
|
|
<Menu />
|
2024-09-09 20:03:24 +02:00
|
|
|
<main>
|
2024-09-10 10:50:51 +02:00
|
|
|
<h2 id="tabslist" class="sr-only">Inspirations</h2>
|
|
|
|
|
<Tabs :tabs="tabs" @update:currentTab="changeTab" />
|
|
|
|
|
<Selector />
|
2024-09-10 16:23:43 +02:00
|
|
|
<section :id="currentTab" class="inspiration">
|
2024-09-10 12:09:53 +02:00
|
|
|
<Header :inspiration="currentInspiration" />
|
2024-09-10 10:50:51 +02:00
|
|
|
<div class="grid masonry">
|
2024-09-11 08:05:35 +02:00
|
|
|
<template
|
2024-09-11 07:32:34 +02:00
|
|
|
v-for="(item, index) in currentInspiration.media"
|
|
|
|
|
:key="item.id"
|
2024-09-11 08:05:35 +02:00
|
|
|
>
|
|
|
|
|
<Image
|
|
|
|
|
:item="item"
|
|
|
|
|
:inspirationUri="currentInspiration.uri"
|
|
|
|
|
:currentTab="currentTab"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
2024-09-10 10:50:51 +02:00
|
|
|
</div>
|
|
|
|
|
</section>
|
2024-09-09 20:03:24 +02:00
|
|
|
</main>
|
|
|
|
|
</div>
|
2024-09-04 11:41:37 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-09-09 20:03:24 +02:00
|
|
|
import Menu from "../components/Menu.vue";
|
2024-09-10 10:50:51 +02:00
|
|
|
import Selector from "../components/inspirations/Selector.vue";
|
|
|
|
|
import Header from "../components/inspirations/Header.vue";
|
|
|
|
|
import Tabs from "../components/Tabs.vue";
|
2024-09-11 07:32:34 +02:00
|
|
|
import Image from "../components/inspirations/Image.vue";
|
2024-09-11 08:05:35 +02:00
|
|
|
import { useUserStore } from "../stores/user";
|
2024-09-10 10:50:51 +02:00
|
|
|
import { ref, computed } from "vue";
|
2024-09-09 20:03:24 +02:00
|
|
|
|
2024-09-04 11:41:37 +02:00
|
|
|
const { data } = defineProps({
|
|
|
|
|
data: Object,
|
|
|
|
|
});
|
|
|
|
|
|
2024-09-11 08:05:35 +02:00
|
|
|
const user = useUserStore().user;
|
2024-09-10 10:50:51 +02:00
|
|
|
const currentTab = ref("all");
|
|
|
|
|
const tabs = computed(() => {
|
|
|
|
|
return [
|
|
|
|
|
{
|
2024-09-10 15:42:52 +02:00
|
|
|
label: "Les Inspirations",
|
2024-09-10 10:50:51 +02:00
|
|
|
id: "all",
|
2024-09-10 15:42:52 +02:00
|
|
|
icon: null,
|
|
|
|
|
count: null,
|
2024-09-10 15:46:28 +02:00
|
|
|
isActive: currentTab.value === "all",
|
2024-09-10 10:50:51 +02:00
|
|
|
},
|
2024-09-10 15:42:52 +02:00
|
|
|
{
|
|
|
|
|
label: "Mes Favoris",
|
|
|
|
|
id: "favorites",
|
|
|
|
|
icon: "favorite",
|
2024-09-11 08:05:35 +02:00
|
|
|
count: favoriteImages.value.length, // TODO: dynamiser (favorites.count)
|
2024-09-10 15:46:28 +02:00
|
|
|
isActive: currentTab.value === "favorites",
|
|
|
|
|
},
|
2024-09-10 10:50:51 +02:00
|
|
|
];
|
|
|
|
|
});
|
|
|
|
|
|
2024-09-11 08:05:35 +02:00
|
|
|
const currentInspiration = ref(data.inspirations[0]);
|
|
|
|
|
const favoriteImages = computed(() => {
|
|
|
|
|
return currentInspiration.value.media.filter(
|
|
|
|
|
(image) => image.favoriteForUsers?.includes(user.uuid) ?? false
|
|
|
|
|
);
|
|
|
|
|
});
|
2024-09-10 12:09:53 +02:00
|
|
|
|
2024-09-10 15:46:28 +02:00
|
|
|
function changeTab(newValue) {
|
|
|
|
|
currentTab.value = newValue;
|
|
|
|
|
}
|
2024-09-04 11:41:37 +02:00
|
|
|
</script>
|
2024-09-09 20:03:24 +02:00
|
|
|
|
2024-09-10 10:50:51 +02:00
|
|
|
<style scoped>
|
2024-09-10 18:10:50 +02:00
|
|
|
/* Tabs */
|
|
|
|
|
[role="tablist"] {
|
|
|
|
|
margin-left: 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-10 10:50:51 +02:00
|
|
|
/* Masonry */
|
|
|
|
|
.masonry {
|
|
|
|
|
--gap: var(--space-8);
|
|
|
|
|
grid-template-columns: repeat(auto-fit, minmax(var(--min, 20rem), 1fr));
|
|
|
|
|
grid-auto-rows: 12rem;
|
|
|
|
|
grid-auto-flow: dense;
|
|
|
|
|
}
|
|
|
|
|
</style>
|