import Button from "@mui/material/Button"; import Typography from "@mui/material/Typography"; import React from "react"; import { useEffect, useRef, useState } from "react"; const ShowMoreText = ({ content, collapsedLines, extraProps, }: { content: string; collapsedLines: number; extraProps?: Record; }) => { const [displayFull, setDisplayFull] = useState(false); const [isOverflowing, setIsOverflowing] = useState(false); const textRef = useRef(null); useEffect(() => { if (textRef.current) { if (textRef.current.offsetHeight < textRef.current.scrollHeight) { setIsOverflowing(true); } else { setIsOverflowing(false); } // textRef.current. } }, []); return (
{content} {content.length > 0 && isOverflowing && ( )}
); }; export default ShowMoreText;