import { useQuery } from '@apollo/client'
import Button from 'react-bootstrap/Button'
import { MORE_FLAT_COMMENTS } from '../fragments/comments'
import { useState } from 'react'
import Comment, { CommentSkeleton } from './comment'
export default function CommentsFlat ({ variables, ...props }) {
const { loading, error, data, fetchMore } = useQuery(MORE_FLAT_COMMENTS, {
variables
})
if (error) return
Failed to load!
if (loading) {
return
}
const { moreFlatComments: { comments, cursor } } = data
return (
<>
{comments.map(item => (
))}
>
)
}
function CommentsFlatSkeleton () {
const comments = new Array(21).fill(null)
return (
{comments.map((_, i) => (
))}
)
}
function MoreFooter ({ cursor, fetchMore }) {
const [loading, setLoading] = useState(false)
if (loading) {
return
}
let Footer
if (cursor) {
Footer = () => (
)
} else {
Footer = () => (
GENISIS
)
}
return
}