import React, { useState } from 'react'; import { Button, Collapse } from 'react-bootstrap'; import { Icon } from 'src/components/Shared'; interface IShowFieldsProps { fields: Map; onShowFieldsChanged: (fields: Map) => void; } export const ShowFields = (props: IShowFieldsProps) => { const [open, setOpen] = useState(false); function handleClick(label: string) { const copy = new Map(props.fields); copy.set(label, !props.fields.get(label)); props.onShowFieldsChanged(copy); } const fieldRows = [...props.fields.entries()].map(([label, enabled]) => (
{ handleClick(label); }} > {label}
)); return (
{fieldRows}
); }