import {
Button,
Modal,
ModalBody,
ModalCloseButton,
ModalContent,
ModalHeader,
ModalOverlay,
useColorModeValue,
useDisclosure,
} from "@chakra-ui/react";
import React, { ReactNode } from "react";
const killEvent = (e) => e.stopPropagation();
export const CollapsableText = ({
text,
maxLength = 220,
isDisabled,
}: {
text: ReactNode;
maxLength?: number;
isDisabled?: boolean;
}) => {
const { isOpen, onOpen, onClose } = useDisclosure();
const moreButtonColor = useColorModeValue("gray.600", "gray.400");
if (typeof text !== "string" || text.length <= maxLength) {
return <>{text}>;
} else {
return (
<>
{text.substring(0, maxLength - 3)}
{/* we kill the event here to disable drag and drop, since it is in the same container */}
Full Text
{text}
>
);
}
};