import { ChevronRightIcon } from '@heroicons/react/outline'; import React, { useState } from 'react'; import { ICategory } from '../../Interfaces/ICategory'; import { TruncateString } from '../../utils/stringtools'; interface ICategoryProps { children: JSX.Element | JSX.Element[] category: ICategory } export function Category(props: ICategoryProps): JSX.Element { const [isOpen, setIsOpen] = useState(false); const categoryType: string = props.category.Type; const categoryDisplayedText: string = props.category.DisplayedText ?? categoryType; return (
setIsOpen(!isOpen)} > {TruncateString(categoryDisplayedText, 25)}
{ props.children }
); }