import "../../../css/components/conversation/comment/commentBody.css"; import { replace } from "../../../lib/domReplace"; import parse from "html-react-parser"; import React, { useEffect, useMemo, useState } from "react"; import Prism from "prismjs"; import { Box, Button } from "@mui/material"; import CommentPopup from "../../../lib/commentPopup"; import { Comment } from "@metahkg/api"; export default function CommentBody(props: { comment: Comment; depth: number; noQuote?: boolean; maxHeight?: string | number; }) { const { comment, depth, noQuote, maxHeight } = props; const [commentJSX] = useState( parse(comment.comment, { replace: replace({ quote: depth > 0 }) }) ); const [quoteOpen, setQuoteOpen] = useState(false); const [showQuote, setShowQuote] = useState(!(depth && depth % 4 === 0)); const content = useMemo( () => [ comment.quote && !noQuote && (
),({ width: 15, "&:hover": { borderLeft: showQuote && `2px solid ${theme.palette.secondary.main}`, }, })} onClick={() => { showQuote && setQuoteOpen(true); }} /> {showQuote ? ( ) : ( )}