File size: 1,163 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// @flow

import * as React from "react";
import cn from "classnames";
import List from "../List";
import Media from "../Media/Media.react";
import Text from "../Text/Text.react";
import CommentList from "./CommentList.react";
import CommentReply from "./CommentReply.react";

type Props = {|
  +children?: React.Node,
  +className?: string,
  +avatarURL?: string,
  +name?: string,
  +date?: string,
  +text?: string,
  +replies?: React.Node,
|};

function Comment({
  className,
  children,
  avatarURL,
  name,
  date,
  text,
  replies,
}: Props): React.Node {
  const classes = cn("py-5", className);

  return (
    <List.GroupItem className={classes}>
      <Media>
        <Media.Object avatar objectURL={avatarURL} size="md" className="mr-4" />
        <Media.Body>
          <Media.Heading>
            <small className="float-right text-muted">{date}</small>
            <h5>{name}</h5>
          </Media.Heading>
          <Text>{text}</Text>
          {replies && <Media.List>{replies}</Media.List>}
        </Media.Body>
      </Media>
    </List.GroupItem>
  );
}

Comment.List = CommentList;
Comment.Reply = CommentReply;

export default Comment;