diff --git a/web/src/components/Article/Article.tsx b/web/src/components/Article/Article.tsx index 8d4b2d0f7..6aa0cbf18 100644 --- a/web/src/components/Article/Article.tsx +++ b/web/src/components/Article/Article.tsx @@ -2,20 +2,16 @@ import type { Post } from 'types/graphql' import { Link, routes } from '@redwoodjs/router' +import CommentForm from 'src/components/CommentForm' import CommentsCell from 'src/components/CommentsCell' const truncate = (text: string, length: number) => { return text.substring(0, length) + '...' } -interface Props { - article: Omit - summary?: boolean -} - -const Article = ({ article, summary = false }: Props) => { +const Article = ({ article, summary = false }) => { return ( -
+

{article.title} @@ -26,7 +22,10 @@ const Article = ({ article, summary = false }: Props) => { {!summary && (
- + +
+ +
)}

diff --git a/web/src/components/CommentForm/CommentForm.tsx b/web/src/components/CommentForm/CommentForm.tsx index 9e1f55228..4846ce2cc 100644 --- a/web/src/components/CommentForm/CommentForm.tsx +++ b/web/src/components/CommentForm/CommentForm.tsx @@ -25,11 +25,15 @@ interface FormValues { comment: string } -const CommentForm = () => { +interface Props { + postId: number +} + +const CommentForm = ({ postId }: Props) => { const [createComment, { loading, error }] = useMutation(CREATE) const onSubmit: SubmitHandler = (input) => { - createComment({ variables: { input } }) + createComment({ variables: { input: { postId, ...input } } }) } return (