Making linter bro happy
This commit is contained in:
parent
85c2161a4d
commit
3abedb256c
2 changed files with 14 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { JSXElement } from "solid-js";
|
import { JSXElement, splitProps } from "solid-js";
|
||||||
|
|
||||||
import { PublicComment } from "../Util/api";
|
import { PublicComment } from "../Util/api";
|
||||||
|
|
||||||
|
@ -7,12 +7,13 @@ interface CommentProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Comment(props: CommentProps): JSXElement {
|
export function Comment(props: CommentProps): JSXElement {
|
||||||
|
const [local] = splitProps(props, ["comment"]);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div class="py-5">
|
<div class="py-5">
|
||||||
<time class="text-xs opacity-50">{props.comment.created_at}</time>
|
<time class="text-xs opacity-50">{local.comment.created_at}</time>
|
||||||
</div>
|
</div>
|
||||||
<div class="">{props.comment.content}</div>
|
<div class="">{local.comment.content}</div>
|
||||||
<div class="divider" />
|
<div class="divider" />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
import { For, JSXElement, createResource } from "solid-js";
|
import { For, JSXElement, createResource, splitProps } from "solid-js";
|
||||||
|
|
||||||
import { getComments } from "../Util/api";
|
import { getComments } from "../Util/api";
|
||||||
import { Comment } from "./Comment";
|
import { Comment } from "./Comment";
|
||||||
|
|
||||||
export function CommentSection(props: { postId: string }): JSXElement {
|
export function CommentSection(postId: { postId: string }): JSXElement {
|
||||||
const [comments] = createResource(props.postId, () =>
|
const [local] = splitProps(postId, ["postId"]);
|
||||||
getComments(props.postId, 10, 0)
|
// Not sure why this is a resource, refetch is not implemented
|
||||||
);
|
const [state] = createResource(() => getComments(local.postId, 10, 0));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section class="my-5 border-b-2 border-b-primary bg-base-200 p-5 ">
|
<div>
|
||||||
<For each={comments()!}>{(comment) => <Comment comment={comment} />}</For>
|
<For each={state()} fallback={<div>Loading...</div>}>
|
||||||
</section>
|
{(comment) => <Comment comment={comment} />}
|
||||||
|
</For>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue