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-10 12:09:53 +02:00
|
|
|
<template v-for="(item, index) in currentInspiration.media">
|
2024-09-10 10:50:51 +02:00
|
|
|
<figure class="flex" :style="'--rows: ' + (index % 2 ? 2 : 3)">
|
|
|
|
|
<button
|
|
|
|
|
class="favorite"
|
|
|
|
|
aria-label="Ajouter aux favoris"
|
|
|
|
|
aria-pressed="false"
|
|
|
|
|
onclick="this.setAttribute('aria-pressed', this.getAttribute('aria-pressed') === 'true' ? 'false' : 'true');"
|
|
|
|
|
>
|
|
|
|
|
<svg
|
|
|
|
|
width="40"
|
|
|
|
|
height="40"
|
|
|
|
|
viewBox="0 0 40 40"
|
|
|
|
|
fill="none"
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
>
|
|
|
|
|
<path
|
|
|
|
|
d="M5.49289 22.5821C5.50453 22.5937 5.51646 22.6051 5.52866 22.6161L19.3287 35.1161C19.7097 35.4613 20.2903 35.4613 20.6713 35.1161L34.4713 22.6161C34.4835 22.6051 34.4955 22.5937 34.5071 22.5821C38.7044 18.3848 37.6545 12.2706 34.2529 8.87931C32.5281 7.15976 30.1519 6.07621 27.4679 6.26656C25.0319 6.43932 22.4673 7.65151 20 10.1579C17.5321 7.65095 14.9651 6.43633 12.5266 6.25964C9.83985 6.06497 7.45863 7.14246 5.72977 8.85914C2.3178 12.247 1.27257 18.3618 5.49289 22.5821Z"
|
|
|
|
|
fill="currentColor"
|
|
|
|
|
stroke="white"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
</button>
|
|
|
|
|
<img :src="item.url" alt="" />
|
|
|
|
|
</figure>
|
|
|
|
|
</template>
|
|
|
|
|
</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";
|
|
|
|
|
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-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",
|
|
|
|
|
count: 6, // 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-10 12:09:53 +02:00
|
|
|
const currentInspiration = data.inspirations[0];
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
.masonry > * {
|
|
|
|
|
position: relative;
|
|
|
|
|
grid-row: span var(--rows);
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
margin: 0;
|
2024-09-10 18:10:50 +02:00
|
|
|
border-radius: var(--rounded-2xl);
|
2024-09-10 10:50:51 +02:00
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
.masonry img {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
}
|
2024-09-10 18:10:50 +02:00
|
|
|
.masonry > *:hover::after {
|
|
|
|
|
content: "";
|
|
|
|
|
position: absolute;
|
|
|
|
|
inset: 0;
|
|
|
|
|
background: var(--color-black-20);
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
|
|
|
|
.masonry > *:hover .favorite {
|
|
|
|
|
display: initial;
|
|
|
|
|
}
|
2024-09-10 10:50:51 +02:00
|
|
|
|
|
|
|
|
/* Favorite button */
|
|
|
|
|
.favorite {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
right: 0;
|
2024-09-10 18:10:50 +02:00
|
|
|
width: 3.5rem;
|
|
|
|
|
height: 3.5rem;
|
2024-09-10 10:50:51 +02:00
|
|
|
margin: var(--space-8);
|
|
|
|
|
padding: var(--space-8);
|
|
|
|
|
color: var(--color-grey-400);
|
2024-09-10 18:10:50 +02:00
|
|
|
display: none;
|
|
|
|
|
z-index: 10;
|
|
|
|
|
}
|
|
|
|
|
.favorite[aria-pressed="false"]:hover::before {
|
|
|
|
|
content: "Ajouter dans mes favoris";
|
|
|
|
|
background: var(--color-background);
|
2024-09-10 18:15:14 +02:00
|
|
|
padding: 1.3rem 3.5rem 1.25rem 1rem;
|
2024-09-10 18:10:50 +02:00
|
|
|
position: absolute;
|
|
|
|
|
z-index: -1;
|
|
|
|
|
inset: -2px;
|
|
|
|
|
left: unset;
|
|
|
|
|
width: max-content;
|
|
|
|
|
border-radius: var(--rounded-xl);
|
|
|
|
|
color: var(--color-grey-700);
|
|
|
|
|
letter-spacing: var(--tracking-wide);
|
|
|
|
|
font-weight: 500;
|
2024-09-10 18:15:14 +02:00
|
|
|
font-size: var(--text-sm);
|
2024-09-10 10:50:51 +02:00
|
|
|
}
|
|
|
|
|
.favorite[aria-pressed="true"] {
|
|
|
|
|
color: var(--color-brand);
|
|
|
|
|
}
|
|
|
|
|
</style>
|