frontend/components/timelines/timeline-item.vue
2024-06-28 17:05:50 -10:00

26 lines
738 B
Vue

<template>
<component :is="itemComponent" :element="item" @update="$emit('update', $event)"
@delete="$emit('delete', item?.id)" />
</template>
<script lang="ts" setup>
import type { Notification, Status } from "@lysand-org/client/types";
import { computed } from "vue";
import NoteItem from "../social-elements/notes/note.vue";
import NotificationItem from "../social-elements/notifications/notif.vue";
const props = defineProps<{
item?: Status | Notification;
type: "status" | "notification";
}>();
const itemComponent = computed(() => {
if (props.type === "status") {
return NoteItem;
}
if (props.type === "notification") {
return NotificationItem;
}
return null;
});
</script>