import React, { Fragment, useState } from "react"; import './data-entry-group.css'; import { DownIcon, RightIcon } from "../../components/icons"; interface DataEntryGroupProps { /** Name of the group */ name: string; /** Whether the group should be collapsed initially */ collapsed?: boolean; showCount?: boolean; } const DataEntryGroup: React.FunctionComponent = (props) => { const { collapsed: initialCollapsed = true, showCount = true } = props; const [collapsed, setCollapsed] = useState(initialCollapsed); return (
setCollapsed(!collapsed)}> {props.name} {showCount && ` (${React.Children.count(props.children)} attributes)`}
{props.children}
); }; const CollapseIcon: React.FunctionComponent<{collapsed: boolean}> = (props) => ( {props.collapsed ? : } ); export { DataEntryGroup };