diff --git a/website/src/components/CollapsableText.tsx b/website/src/components/CollapsableText.tsx new file mode 100644 index 00000000..b0cfb3b9 --- /dev/null +++ b/website/src/components/CollapsableText.tsx @@ -0,0 +1,28 @@ +import { Button, useDisclosure } from "@chakra-ui/react"; +import { Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, ModalCloseButton } from "@chakra-ui/react"; +import React from "react"; + +export const CollapsableText = ({ text, maxLength = 220 }) => { + const { isOpen, onOpen, onClose } = useDisclosure(); + if (typeof text != "string" || text.length <= maxLength) { + return text; + } else { + return ( + <> + {text.substring(0, maxLength - 3)} + + + + + Full Text + + {text} + + + + + ); + } +}; diff --git a/website/src/components/Sortable/Sortable.tsx b/website/src/components/Sortable/Sortable.tsx index 2f63ff27..269c39a4 100644 --- a/website/src/components/Sortable/Sortable.tsx +++ b/website/src/components/Sortable/Sortable.tsx @@ -17,6 +17,7 @@ import { verticalListSortingStrategy, } from "@dnd-kit/sortable"; import { ReactNode, useEffect, useState } from "react"; +import { CollapsableText } from "../CollapsableText"; import { SortableItem } from "./SortableItem"; @@ -64,7 +65,7 @@ export const Sortable = (props: SortableProps) => { {itemsWithIds.map(({ id, item }) => ( - {item} + ))}