Compare commits
No commits in common. '0684ab36f2934344ff96cd6aa046df1628c5d39c' and '81f8336543ffbab82fbb194ff22ef4953e535867' have entirely different histories.
0684ab36f2
...
81f8336543
@ -1,47 +1,34 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
type Post = {
|
type Post = {
|
||||||
user: {
|
user: {
|
||||||
name: String
|
name: String
|
||||||
}
|
}
|
||||||
description: String
|
title: String
|
||||||
created_at: string
|
description: 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 gap-4 border border-lightgray p-6">
|
<div class="flex w-full flex-col gap-6 rounded-md border border-lightgray bg-secondary p-6">
|
||||||
<div>
|
<div class="flex justify-between">
|
||||||
<Icon
|
<div class="flex h-full gap-4">
|
||||||
name="user"
|
<Icon name="user" />
|
||||||
size="40" />
|
{{ props.user.name }}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex w-full flex-col gap-2">
|
<div>
|
||||||
<div class="flex w-full justify-between">
|
{{ new Date(props.created_at).toLocaleString() }}
|
||||||
<div class="flex h-full gap-4 font-bold">
|
</div>
|
||||||
{{ props.user.name }}
|
</div>
|
||||||
</div>
|
<div class="h-full truncate text-xl font-bold">
|
||||||
<div>
|
{{ props.title }}
|
||||||
{{ displayTime() }}
|
</div>
|
||||||
</div>
|
<div class="h-full">
|
||||||
</div>
|
{{ props.description }}
|
||||||
<div class="h-full whitespace-pre-line">
|
</div>
|
||||||
{{ props.description }}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Loading…
Reference in New Issue