Skip to content

Commit e0c46b7

Browse files
committed
feat(calendar): adds empty placeholder
1 parent d683592 commit e0c46b7

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/components/common/list/ListItem.vue

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { NFlex, NImage, NSkeleton, NTime, NTimelineItem } from 'naive-ui';
2+
import { NEmpty, NFlex, NImage, NSkeleton, NTime, NTimelineItem } from 'naive-ui';
33
44
import {
55
computed,
@@ -21,6 +21,7 @@ import {
2121
2222
import { useImageStore } from '~/stores/data/image.store';
2323
import { Colors } from '~/styles/colors.style';
24+
import { useI18n } from '~/utils';
2425
2526
const props = defineProps({
2627
item: {
@@ -77,6 +78,8 @@ const emit = defineEmits<{
7778
(e: 'onScrollOutOfView', event: { item: ListScrollItem; ref?: HTMLDivElement }): void;
7879
}>();
7980
81+
const i18n = useI18n('list', 'item');
82+
8083
const { item, noHeader, nextHasHeader, poster, episode, hideDate, scrollIntoView } =
8184
toRefs(props);
8285
@@ -211,7 +214,9 @@ const ListScrollItemTypeLocal = ListScrollItemType;
211214
</NFlex>
212215

213216
<slot v-if="item.type === ListScrollItemTypeLocal.placeholder">
214-
// TODO default placeholder
217+
<NFlex class="placeholder" align="center" justify="center" :wrap="false">
218+
<NEmpty size="large" :description="i18n('placeholder_empty')" />
219+
</NFlex>
215220
</slot>
216221
<NFlex v-else class="tile" :wrap="false">
217222
<NImage
@@ -261,6 +266,8 @@ const ListScrollItemTypeLocal = ListScrollItemType;
261266
}
262267
263268
.content {
269+
height: 100%;
270+
264271
.tile {
265272
@include mixin.hover-background(
266273
$from: transparent,
@@ -271,6 +278,10 @@ const ListScrollItemTypeLocal = ListScrollItemType;
271278
flex: 1 1 auto;
272279
padding: 0.5rem;
273280
}
281+
282+
.placeholder {
283+
flex: 1 1 auto;
284+
}
274285
}
275286
276287
.header {
@@ -387,9 +398,14 @@ const ListScrollItemTypeLocal = ListScrollItemType;
387398
}
388399
389400
.n-timeline-item-content {
401+
height: 100%;
390402
margin-left: calc(var(--n-icon-size) + 0.125rem);
391403
border-top: 1px solid transparent;
392404
405+
&__content {
406+
height: 100%;
407+
}
408+
393409
&__meta {
394410
margin: 0;
395411
}

src/i18n/en/list/list.json

+4
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@
1818
"list__more__current_page_size": {
1919
"message": "Current page size is",
2020
"description": "Current page size label."
21+
},
22+
"list__item__placeholder_empty": {
23+
"message": "Nothing on this day.",
24+
"description": "Empty placeholder for list item."
2125
}
2226
}

0 commit comments

Comments
 (0)