-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9843d3
commit 3fcec64
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.guestbook { | ||
width: clamp(0px, map-get($container-width, small), 100%); | ||
margin: $global-navigation-height auto 0; | ||
|
||
&__title { | ||
margin: 24px 12px; | ||
text-align: center; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { revalidateTag } from "next/cache"; | ||
import { Suspense } from "react"; | ||
import { classNames } from "@marshallku/utils"; | ||
import { getComments, postComment } from "#api/comment/api.server"; | ||
import CommentForm from "#components/CommentForm"; | ||
import CommentList from "#components/CommentList"; | ||
import Typography from "#components/Typography"; | ||
import styles from "./page.module.scss"; | ||
|
||
const SLUG = "/guestbook"; | ||
|
||
const cx = classNames(styles, "guestbook"); | ||
|
||
async function Comments() { | ||
const data = await getComments(SLUG); | ||
return <CommentList data={data} />; | ||
} | ||
|
||
export default async function GuestbookPage() { | ||
return ( | ||
<div className={cx()}> | ||
<Typography variant="h1" component="h1" className={cx("__title")} fontWeight={700}> | ||
방명록 | ||
</Typography> | ||
<CommentForm | ||
slug={SLUG} | ||
submit={async (data) => { | ||
"use server"; | ||
|
||
await postComment(data); | ||
revalidateTag(SLUG); | ||
}} | ||
/> | ||
<Suspense fallback={<p>Loading...</p>}> | ||
<Comments /> | ||
</Suspense> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters