import { JSX, ParentComponent, Show } from 'solid-js' import { twMerge } from 'tailwind-merge' type Props = { title: JSX.Element content: JSX.Element isOpen?: boolean onCollapse: (collapsed: boolean) => void } export const Collapse: ParentComponent = (props) => { const { title, content, onCollapse } = props const getCollapseClassName = () => { const openedClassName = 'collapse-open' const closedClassName = 'collapse-close' return props.isOpen ? openedClassName : closedClassName } const getCollapseContentClassName = () => { const openedClassName = 'opacity-100' const closedClassName = 'opacity-0' return props.isOpen ? openedClassName : closedClassName } return (
onCollapse(!props.isOpen)} > {title}
{content}
) }