File tree Expand file tree Collapse file tree 2 files changed +34
-29
lines changed
Expand file tree Collapse file tree 2 files changed +34
-29
lines changed Original file line number Diff line number Diff line change @@ -3,36 +3,41 @@ import { graphql } from "relay-runtime";
33import { useFragment } from "react-relay" ;
44import type { StoryCommentsSectionFragment$key } from "./__generated__/StoryCommentsSectionFragment.graphql" ;
55import Comment from "./Comment" ;
6-
7- const { useState, useTransition } = React ;
6+ import LoadMoreCommentsButton from "./LoadMoreCommentsButton" ;
87
98export type Props = {
109 story : StoryCommentsSectionFragment$key ;
1110} ;
1211
1312const StoryCommentsSectionFragment = graphql `
1413 fragment StoryCommentsSectionFragment on Story {
15- comments(first: 1) {
16- pageInfo {
17- startCursor
18- }
14+ comments(first: 3) {
1915 edges {
2016 node {
2117 id
2218 ...CommentFragment
2319 }
2420 }
21+ pageInfo {
22+ hasNextPage
23+ }
2524 }
2625 }
2726` ;
2827
2928export default function StoryCommentsSection ( { story } : Props ) {
3029 const data = useFragment ( StoryCommentsSectionFragment , story ) ;
30+ const onLoadMore = ( ) => {
31+ /* TODO */
32+ } ;
3133 return (
3234 < div >
3335 { data . comments . edges . map ( ( edge ) => (
3436 < Comment key = { edge . node . id } comment = { edge . node } />
3537 ) ) }
38+ { data . comments . pageInfo . hasNextPage && (
39+ < LoadMoreCommentsButton onClick = { onLoadMore } />
40+ ) }
3641 </ div >
3742 ) ;
3843}
You can’t perform that action at this time.
0 commit comments