Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | import Icon from 'antd/lib/icon'; import * as React from 'react'; import { Query } from 'react-apollo'; import styled from 'styled-components'; import { IComment } from '../../../../shared'; import { getArticlePath } from '../../article/utils'; import ErrorMessage from '../../components/ErrorMessage'; import Helmet from '../../components/Helmet'; import Link from '../../components/Link'; import Loader from '../../components/Loader'; import Page from '../../components/Page'; import CreateComment from '../create/CreateComment'; import { ARTICLE } from '../queries'; import Comment from './Comment'; interface IProps { match: { params: { articleSlug: string; }; }; } const Wrapper = styled.div` margin-top: 20px; .ant-comment-inner { padding: 0; } .ant-comment-avatar { display: none; } `; const CommentList = ({ match }: IProps) => { const { articleSlug } = match.params; return ( <Page> <Query query={ARTICLE} variables={{ slug: articleSlug }}> {({ loading, error, data }) => { if (loading) { return <Loader />; } if (error) { return <ErrorMessage message={error.message} />; } return ( <React.Fragment> <Helmet title={`Diskuze ke článku: ${data.article.title}`} /> <Link to={getArticlePath(data.article)}> <Icon type="left" style={{ marginRight: '10px' }} /> Zpět na článek </Link> <CreateComment article={data.article} /> <Wrapper> {data.article.comments.map((comment: IComment) => ( <Comment article={data.article} key={comment._id} comment={comment} /> ))} </Wrapper> </React.Fragment> ); }} </Query> </Page> ); }; export default CommentList; |