/** * External dependencies */ import { useState } from '@wordpress/element'; import classNames from 'classnames'; import { Icon, chevronUp, chevronDown } from '@wordpress/icons'; import type { ReactNode, ReactElement } from 'react'; /** * Internal dependencies */ import './style.scss'; export interface PanelProps { children: ReactNode; className?: string | undefined; initialOpen?: boolean; hasBorder?: boolean; title: ReactNode; titleTag?: keyof JSX.IntrinsicElements; } const Panel = ( { children, className, initialOpen = false, hasBorder = false, title, titleTag: TitleTag = 'div', }: PanelProps ): ReactElement => { const [ isOpen, setIsOpen ] = useState< boolean >( initialOpen ); return (
{ isOpen && (
{ children }
) }
); }; export default Panel;