import { useLocalStorage } from '@mantine/hooks'; import { IoChevronDown } from 'react-icons/io5'; import { cx } from '../../utils/styleUtils'; import { OptionTitle } from './constants'; import ParamInput from './ParamInput'; import { type ParamField } from './viewParams.types'; import style from './ViewParamsSection.module.scss'; interface ViewParamsSectionProps { title: string; collapsible?: boolean; options: ParamField[]; } export default function ViewParamsSection({ title, collapsible, options }: ViewParamsSectionProps) { const [collapsed, setCollapsed] = useLocalStorage({ key: `params-${title}`, defaultValue: false }); const handleCollapse = () => { if (collapsible) { setCollapsed((prev) => !prev); } }; return (
{title === OptionTitle.Hidden ? ( ) : ( <>
{title} {collapsible && }
)}
); } interface SectionContentsProps { options: ParamField[]; collapsed: boolean; } function SectionContents({ options, collapsed }: SectionContentsProps) { return ( <> {options.map((option) => { return ( ); })} ); } function HiddenContents({ options }: { options: ParamField[] }) { return ( <> {options.map((option, index) => { return ; })} ); }