FrostByte/client-solid/src/Components/Comment.tsx

34 lines
1 KiB
TypeScript
Raw Normal View History

import { JSXElement } from "solid-js";
import { PublicComment } from "../Util/api";
import ReplyButton from "./Buttons/Reply";
interface CommentProps {
comment: PublicComment;
}
2024-03-06 00:48:19 +01:00
/**
* Comment is a component that displays a single comment.
* @param {Object} props The properties for the Comment component.
* @param {string} props.postId The id of the post that the comment is a reply to.
* @returns {JSXElement} A JSXElement of a comment
*/
export function Comment({ comment }: CommentProps): JSXElement {
2024-03-06 00:48:19 +01:00
return (
<>
<div class="chat chat-start py-5">
<time class="text-xs opacity-50">{comment.created_at}</time>
2024-03-06 00:48:19 +01:00
</div>
<div class="chat-">{comment.content}</div>
<div class="divider"></div>
<div class="chat chat-end">
<div class="flex-col">
<time class="text-xs opacity-50 time-end">Reply created_at</time>
<div class="chat-end">Replies to parent comment if any</div>
</div>
</div>
<div class="divider divider-end"><ReplyButton/></div>
</>
2024-03-06 00:48:19 +01:00
);
}