Frontend: update postcard ui (color and layout)

main
TZGyn 2 years ago
parent fa9f5f7a53
commit 0684ab36f2
Signed by: TZGyn
GPG Key ID: 122EAF77AE81FD4A

@ -3,32 +3,45 @@ type Post = {
user: {
name: String
}
title: String
description: String
created_at: string
}
const props = defineProps<Post>()
const now = new Date().toLocaleDateString()
const postTime = new Date(props.created_at)
const displayTime = () => {
if (now == postTime.toLocaleDateString()) {
return postTime.toLocaleTimeString()
}
return postTime.toLocaleDateString()
}
</script>
<template>
<div>
<div class="flex w-full flex-col gap-6 rounded-md border border-lightgray bg-secondary p-6">
<div class="flex justify-between">
<div class="flex h-full gap-4">
<Icon name="user" />
<div class="flex w-full gap-4 border border-lightgray p-6">
<div>
<Icon
name="user"
size="40" />
</div>
<div class="flex w-full flex-col gap-2">
<div class="flex w-full justify-between">
<div class="flex h-full gap-4 font-bold">
{{ props.user.name }}
</div>
<div>
{{ new Date(props.created_at).toLocaleString() }}
{{ displayTime() }}
</div>
</div>
<div class="h-full truncate text-xl font-bold">
{{ props.title }}
</div>
<div class="h-full">
<div class="h-full whitespace-pre-line">
{{ props.description }}
</div>
</div>
</div>
</div>
</template>

Loading…
Cancel
Save