import React, { ReactNode, HTMLAttributes } from 'react'; import AnimateHeight from 'react-animate-height'; import { TreeLayer, TreeNodeProps as TreeNodeType } from '../recursive-tree'; import { indentStyle } from '../indent'; import styles from './collapsing-node.module.scss'; export type CollapsingNodeProps = { /** * The title to be rendered and to be clicked to open the content. */ title: ReactNode; /** * If the content is open or not. */ isOpen?: boolean; } & Omit, 'title'> & TreeNodeType; export function CollapsingNode({ title, isOpen = false, node, depth, className }: CollapsingNodeProps) { return (
{title} {node.children && (
)}
); }