Formatting
This commit is contained in:
parent
368d7c9c65
commit
3a42624042
4 changed files with 13 additions and 10 deletions
|
@ -10,9 +10,7 @@ import { Comment } from "./Comment";
|
||||||
* @returns {JSXElement} A JSXElement that contains a collection of comments.
|
* @returns {JSXElement} A JSXElement that contains a collection of comments.
|
||||||
*/
|
*/
|
||||||
export function CommentSection({ postId }: { postId: string }): JSXElement {
|
export function CommentSection({ postId }: { postId: string }): JSXElement {
|
||||||
const [comments] = createResource(postId, () =>
|
const [comments] = createResource(postId, () => getComments(postId, 10, 0));
|
||||||
getComments(postId, 10, 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<For each={comments()!}>{(comment) => <Comment comment={comment} />}</For>
|
<For each={comments()!}>{(comment) => <Comment comment={comment} />}</For>
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
import { useParams } from "@solidjs/router";
|
import { useParams } from "@solidjs/router";
|
||||||
import { JSXElement, Show, Suspense, createResource, useContext } from "solid-js";
|
import {
|
||||||
|
JSXElement,
|
||||||
|
Show,
|
||||||
|
Suspense,
|
||||||
|
createResource,
|
||||||
|
useContext,
|
||||||
|
} from "solid-js";
|
||||||
|
|
||||||
import { LoginContext } from "../Context/GlobalState";
|
import { LoginContext } from "../Context/GlobalState";
|
||||||
import { loadSpinner } from "../Util/Icons";
|
import { loadSpinner } from "../Util/Icons";
|
||||||
import { getPost } from "../Util/api";
|
import { getPost } from "../Util/api";
|
||||||
import { CommentSection } from "./CommentSection";
|
import { CommentSection } from "./CommentSection";
|
||||||
import { PostSegment } from "./Posts";
|
|
||||||
import { NewCommentInputArea } from "./NewComment";
|
import { NewCommentInputArea } from "./NewComment";
|
||||||
|
import { PostSegment } from "./Posts";
|
||||||
|
|
||||||
export function SinglePost(): JSXElement {
|
export function SinglePost(): JSXElement {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
@ -17,7 +24,7 @@ export function SinglePost(): JSXElement {
|
||||||
<Show when={post()}>
|
<Show when={post()}>
|
||||||
<PostSegment post={post()!} />
|
<PostSegment post={post()!} />
|
||||||
<Show when={login_ctx.loggedIn()}>
|
<Show when={login_ctx.loggedIn()}>
|
||||||
<NewCommentInputArea parentPostId={parseInt(params.postid)}/>
|
<NewCommentInputArea parentPostId={parseInt(params.postid)} />
|
||||||
</Show>
|
</Show>
|
||||||
<CommentSection postId={params.postid} />
|
<CommentSection postId={params.postid} />
|
||||||
</Show>
|
</Show>
|
||||||
|
|
|
@ -3,8 +3,6 @@ import { JSXElement } from "solid-js";
|
||||||
// MainContainer is the main container for the page.
|
// MainContainer is the main container for the page.
|
||||||
export function PageContainer(props: { children: JSXElement }): JSXElement {
|
export function PageContainer(props: { children: JSXElement }): JSXElement {
|
||||||
return (
|
return (
|
||||||
<div class="flex min-h-screen flex-col items-center">
|
<div class="flex min-h-screen flex-col items-center">{props.children}</div>
|
||||||
{props.children}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue