Frontend: update postcard ui (color and layout)
parent
fa9f5f7a53
commit
0684ab36f2
@ -1,34 +1,47 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
type Post = {
|
type Post = {
|
||||||
user: {
|
user: {
|
||||||
name: String
|
name: String
|
||||||
}
|
}
|
||||||
title: String
|
description: String
|
||||||
description: String
|
created_at: string
|
||||||
created_at: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Post>()
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="flex w-full flex-col gap-6 rounded-md border border-lightgray bg-secondary p-6">
|
<div class="flex w-full gap-4 border border-lightgray p-6">
|
||||||
<div class="flex justify-between">
|
<div>
|
||||||
<div class="flex h-full gap-4">
|
<Icon
|
||||||
<Icon name="user" />
|
name="user"
|
||||||
{{ props.user.name }}
|
size="40" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex w-full flex-col gap-2">
|
||||||
{{ new Date(props.created_at).toLocaleString() }}
|
<div class="flex w-full justify-between">
|
||||||
</div>
|
<div class="flex h-full gap-4 font-bold">
|
||||||
</div>
|
{{ props.user.name }}
|
||||||
<div class="h-full truncate text-xl font-bold">
|
</div>
|
||||||
{{ props.title }}
|
<div>
|
||||||
</div>
|
{{ displayTime() }}
|
||||||
<div class="h-full">
|
</div>
|
||||||
{{ props.description }}
|
</div>
|
||||||
</div>
|
<div class="h-full whitespace-pre-line">
|
||||||
</div>
|
{{ props.description }}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Loading…
Reference in New Issue