@@ -15,6 +15,7 @@ import {
15
15
type VirtualListProps ,
16
16
type VirtualListRef ,
17
17
} from ' ~/models/list-scroll.model' ;
18
+ import { watchMedia } from ' ~/utils/window.utils' ;
18
19
19
20
const listRef = ref <VirtualListRef >();
20
21
@@ -43,6 +44,10 @@ const props = defineProps({
43
44
type: Boolean ,
44
45
required: false ,
45
46
},
47
+ hidePoster: {
48
+ type: Boolean ,
49
+ required: false ,
50
+ },
46
51
hideDate: {
47
52
type: Boolean ,
48
53
required: false ,
@@ -105,7 +110,8 @@ defineExpose({
105
110
list: listRef ,
106
111
});
107
112
108
- const { items, loading, pagination, scrollThreshold, listOptions } = toRefs (props );
113
+ const { items, loading, pagination, scrollThreshold, listOptions, backdrop, hidePoster } =
114
+ toRefs (props );
109
115
110
116
const scrolled = ref (false );
111
117
@@ -143,7 +149,8 @@ const onLoadMore = (payload: { page: number; pageCount: number; pageSize: number
143
149
};
144
150
145
151
const isEmpty = computed (() => ! items .value .length && ! loading .value );
146
- const listItemSize = computed (() => listOptions ?.value ?.itemSize ?? 145 );
152
+ const defaultSize = computed (() => (hidePoster .value ? 130 : 145 ));
153
+ const listItemSize = computed (() => listOptions ?.value ?.itemSize ?? defaultSize .value );
147
154
148
155
const topInset = computed (() => {
149
156
const listElementRef = listRef .value ?.$el ;
@@ -158,6 +165,12 @@ const listPaddingTop = computed(
158
165
() => topInset .value + (listOptions ?.value ?.paddingTop ?? 60 ),
159
166
);
160
167
const listPaddingBottom = computed (() => listOptions ?.value ?.paddingBottom ?? 32 );
168
+
169
+ const isCompact = watchMedia (' (max-width: 600px)' );
170
+ const showBackdrop = computed (() => backdrop ?.value && ! isCompact .value );
171
+
172
+ const isTiny = watchMedia (' (max-width: 350px)' );
173
+ const showPoster = computed (() => ! hidePoster ?.value && ! isTiny .value );
161
174
</script >
162
175
163
176
<template >
@@ -192,7 +205,7 @@ const listPaddingBottom = computed(() => listOptions?.value?.paddingBottom ?? 32
192
205
vertical
193
206
size =" small"
194
207
:theme-overrides =" { gapSmall: '0' }"
195
- :style =" `height: ${listOptions?.itemSize ?? 145 }px;`"
208
+ :style =" `height: ${listOptions?.itemSize ?? defaultSize }px;`"
196
209
>
197
210
<ListLoadMore
198
211
:page =" pagination?.page"
@@ -206,12 +219,13 @@ const listPaddingBottom = computed(() => listOptions?.value?.paddingBottom ?? 32
206
219
v-else
207
220
:key =" item.id"
208
221
:item =" item"
209
- :height =" listOptions?.itemSize ?? 145 "
222
+ :height =" listOptions?.itemSize ?? defaultSize "
210
223
:size =" items.length"
211
224
:hide-date =" hideDate"
212
225
:hide-time =" hideTime"
226
+ :hide-poster =" !showPoster"
227
+ :backdrop =" showBackdrop"
213
228
:content-height =" contentHeight"
214
- :backdrop =" backdrop"
215
229
:hover =" hoverDate === item.date?.current?.toDateString()"
216
230
:scroll-into-view =" scrollIntoView?.includes(item.id)"
217
231
:show-progress =" showProgress"
0 commit comments