({
comment,
parentComment,
className,
onCommented,
isModalThread = false,
isFirst = false,
isLast = false,
extendTopConnector = false,
...props
}: SubCommentProps)
| 27 | } |
| 28 | |
| 29 | function SubComment({ |
| 30 | comment, |
| 31 | parentComment, |
| 32 | className, |
| 33 | onCommented, |
| 34 | isModalThread = false, |
| 35 | isFirst = false, |
| 36 | isLast = false, |
| 37 | extendTopConnector = false, |
| 38 | ...props |
| 39 | }: SubCommentProps): ReactElement { |
| 40 | const { inputProps, commentId, onReplyTo } = useComments(props.post); |
| 41 | const { inputProps: editProps, onEdit } = useEditCommentProps(); |
| 42 | |
| 43 | return ( |
| 44 | <> |
| 45 | {!editProps && ( |
| 46 | <CommentBox |
| 47 | {...props} |
| 48 | key={comment.id} |
| 49 | parentId={parentComment.id} |
| 50 | comment={comment} |
| 51 | onEdit={({ id, lastUpdatedAt }) => |
| 52 | onEdit({ |
| 53 | commentId: id, |
| 54 | lastUpdatedAt, |
| 55 | parentCommentId: parentComment.id, |
| 56 | }) |
| 57 | } |
| 58 | className={{ |
| 59 | container: classNames( |
| 60 | 'relative', |
| 61 | isModalThread && |
| 62 | 'rounded-none bg-transparent px-0 py-2 hover:bg-transparent', |
| 63 | isModalThread && !isLast && 'mb-1', |
| 64 | ), |
| 65 | content: classNames('ml-[52px]', isModalThread && 'mt-1'), |
| 66 | markdown: classNames( |
| 67 | isModalThread && |
| 68 | '!text-[0.9375rem] [&_a]:!text-[0.9375rem] [&_li]:!text-[0.9375rem] [&_li]:!leading-[1.55] [&_p]:!text-[0.9375rem] [&_p]:!leading-[1.55]', |
| 69 | ), |
| 70 | }} |
| 71 | onComment={(selected, parent) => |
| 72 | onReplyTo({ |
| 73 | username: comment.author?.username ?? null, |
| 74 | parentCommentId: parent, |
| 75 | commentId: selected.id, |
| 76 | }) |
| 77 | } |
| 78 | isModalThread={isModalThread} |
| 79 | > |
| 80 | {!isModalThread && ( |
| 81 | <div |
| 82 | className="absolute bottom-0 left-9 top-0 -ml-px w-0.5 bg-surface-float" |
| 83 | data-testid="subcomment" |
| 84 | /> |
| 85 | )} |
| 86 | {isModalThread && ( |
nothing calls this directly
no test coverage detected