import React, { useState } from "react";
import Button, { ButtonStyleType } from "../Button/Button";
const LongTextViewer = (props) => {
    const [showFullText, setShowFullText] = useState(false);
    const characterLimit = 100;
    const shouldTruncate = !props.disableTruncation && props.text.length > characterLimit;
    const displayText = shouldTruncate && !showFullText
        ? `${props.text.substring(0, characterLimit)}...`
        : props.text;
    return (React.createElement("div", { className: "max-w-2xl break-words" },
        React.createElement("div", { className: "whitespace-pre-wrap" }, displayText),
        shouldTruncate && (React.createElement(Button, { className: "-mt-1 -ml-3", onClick: () => {
                return setShowFullText(!showFullText);
            }, title: showFullText ? "Show less" : "Show more", buttonStyle: ButtonStyleType.SECONDARY_LINK }))));
};
export default LongTextViewer;
//# sourceMappingURL=LongTextViewer.js.map