Skip to content

Commit 983e75b

Browse files
committed
fix: PoiCardLight images overlapping container #474
1 parent 826b3c0 commit 983e75b

File tree

3 files changed

+86
-44
lines changed

3 files changed

+86
-44
lines changed

components/PoisCard/PoiCardLight.vue

+76-41
Original file line numberDiff line numberDiff line change
@@ -4,83 +4,118 @@ import TeritorioIconBadge from '~/components/UI/TeritorioIconBadge.vue'
44
import UIPicture from '~/components/UI/UIPicture.vue'
55
import type { ApiPoi } from '~/lib/apiPois'
66
7-
//
8-
// Props
9-
//
107
const props = withDefaults(defineProps<{
118
notebook?: boolean
129
poi: ApiPoi
1310
}>(), {
1411
notebook: false,
1512
})
1613
17-
//
18-
// Composables
19-
//
2014
const { featureName } = useFeature(toRef(() => props.poi), { type: 'popup' })
2115
22-
//
23-
// Data
24-
//
2516
const colorFill = ref(props.poi.properties.display?.color_fill || 'black')
2617
const colorLine = ref(props.poi.properties.display?.color_line || 'black')
2718
const websiteDetails = ref(props.poi.properties.editorial && props.poi.properties.editorial['website:details'])
2819
</script>
2920

3021
<template>
31-
<div
32-
:id="`PoiCardLight-${poi.properties.metadata.id}`"
33-
class="tw-flex-col md:tw-flex-row tw-h-auto tw-shrink-0 tw-flex tw-items-start tw-gap-4 tw-justify-between tw-box-border tw-w-full tw-border-gray-300 tw-border-t tw-pt-4 first-of-type:tw-border-t-0"
34-
>
22+
<article :id="`PoiCardLight-${poi.properties.metadata.id}`">
3523
<div>
36-
<div class="tw-flex tw-items-center tw-shrink-0 tw-mb-2">
37-
<h3
38-
class="tw-block tw-text-xl tw-font-semibold tw-leading-tight tw-flex tw-items-center tw-gap-2"
39-
:style="`color:${colorLine}`"
40-
>
41-
<TeritorioIconBadge
42-
v-if="props.poi.properties.display?.icon || poi.properties.display?.text"
43-
:color-fill="colorFill"
44-
:picto="props.poi.properties.display?.icon"
45-
size="lg"
46-
:image="undefined"
47-
:text="poi.properties.display?.text"
48-
/>
24+
<header>
25+
<TeritorioIconBadge
26+
v-if="props.poi.properties.display?.icon || poi.properties.display?.text"
27+
:color-fill="colorFill"
28+
:picto="props.poi.properties.display?.icon"
29+
:image="undefined"
30+
:text="poi.properties.display?.text"
31+
size="lg"
32+
/>
33+
<h3 class="tw-text-xl tw-font-semibold tw-leading-tight" :style="`color:${colorLine}`">
4934
{{ featureName }}
5035
</h3>
5136

5237
<a
5338
v-if="Boolean(websiteDetails)"
54-
class="tw-ml-6 md:tw-ml-8 tw-px-3 tw-py-1.5 tw-text-xs tw-text-zinc-800 tw-bg-zinc-100 hover:tw-bg-zinc-200 focus:tw-bg-zinc-200 tw-transition tw-transition-colors tw-rounded-md"
5539
:href="websiteDetails"
40+
class="tw-text-xs tw-text-zinc-800 tw-bg-zinc-100 hover:tw-bg-zinc-200 focus:tw-bg-zinc-200 tw-transition tw-transition-colors"
5641
rel="noopener noreferrer"
5742
target="_blank"
5843
>
5944
{{ $t('poiCard.details') }}
6045
</a>
61-
</div>
62-
<Fields
63-
:fields="
64-
(poi.properties.editorial && poi.properties.editorial.popup_fields)
65-
|| []
66-
"
67-
:properties="poi.properties"
68-
:details="websiteDetails"
69-
:geom="poi.geometry"
70-
/>
46+
</header>
47+
48+
<section>
49+
<Fields
50+
:fields="(poi.properties.editorial && poi.properties.editorial.popup_fields) || []"
51+
:properties="poi.properties"
52+
:details="websiteDetails"
53+
:geom="poi.geometry"
54+
/>
55+
</section>
7156
</div>
57+
7258
<UIPicture
7359
v-if="poi.properties.image && poi.properties.image.length > 0"
74-
class="tw-w-full tw-h-32 md:tw-w-32 md:tw-h-32 tw-z-10 tw-contents"
7560
:src="poi.properties.image[0]"
7661
:alt="$t('poiCard.thumbnail')"
7762
media-size="8rem"
7863
/>
79-
</div>
64+
</article>
8065
</template>
8166

8267
<style scoped>
83-
h3 {
84-
margin-bottom: 0 !important;
68+
article {
69+
display: flex;
70+
flex-direction: column;
71+
gap: 1rem;
72+
}
73+
74+
article:not(:last-of-type) {
75+
border-bottom: 1px solid #d1d5db;
76+
padding-bottom: 1rem;
77+
}
78+
79+
article > div {
80+
display: flex;
81+
flex-direction: column;
82+
gap: 0.5rem;
83+
}
84+
85+
header {
86+
align-items: center;
87+
display: flex;
88+
gap: 0.5rem;
89+
}
90+
91+
header > a {
92+
padding: 0.5rem;
93+
border-radius: 4px;
94+
margin-left: auto;
95+
align-self: flex-start;
96+
}
97+
98+
header > h3 {
99+
margin: 0;
100+
}
101+
102+
article > picture:deep(img) {
103+
width: 100%;
104+
max-height: 280px;
105+
object-fit: scale-down;
106+
}
107+
108+
@media (width >= 768px) {
109+
article {
110+
flex-direction: row;
111+
}
112+
113+
article > div {
114+
flex: 70%;
115+
}
116+
117+
article > picture {
118+
flex: 30%;
119+
}
85120
}
86121
</style>

components/PoisCard/PoisDeck.vue

+10-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const emit = defineEmits<{
1616
</script>
1717

1818
<template>
19-
<div v-if="isCardLight" class="tw-flex tw-justify-between tw-flex-wrap tw-gap-6">
19+
<div v-if="isCardLight" class="pois-deck">
2020
<component
2121
:is="PoiCardLight"
2222
v-for="item in pois"
@@ -25,7 +25,7 @@ const emit = defineEmits<{
2525
class="tw-grow-1 poi-deck"
2626
/>
2727
</div>
28-
<div v-else class="tw-flex tw-justify-between tw-flex-wrap tw-gap-6">
28+
<div v-else class="pois-deck">
2929
<component
3030
:is="PoiCard"
3131
v-for="item in pois"
@@ -39,3 +39,11 @@ const emit = defineEmits<{
3939
/>
4040
</div>
4141
</template>
42+
43+
<style lang="css" scoped>
44+
.pois-deck {
45+
display: flex;
46+
flex-direction: column;
47+
gap: 1rem;
48+
}
49+
</style>

components/UI/UIPicture.vue

-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ export default defineComponent({
100100
// sizes: nSources.value[0].sizes,
101101
sizes: props.mediaSize, // Monkey path, replace: nSources.value[0].sizes,
102102
srcset: nSources.value[0].srcset,
103-
style: 'tw-w-full',
104103
}),
105104
])
106105
},

0 commit comments

Comments
 (0)