/** * External dependencies */ import { Button } from '@wordpress/components'; import ChevronUpIcon from 'gridicons/dist/chevron-up'; import ChevronDownIcon from 'gridicons/dist/chevron-down'; import { useState } from '@wordpress/element'; /** * Internal dependencies */ import './Toggle.scss'; export const Toggle = ( { children, heading, onToggle } ) => { const [ isShow, setIsShow ] = useState( false ); const onClick = () => { onToggle( isShow ); setIsShow( ! isShow ); }; return (
{ isShow ? children : null }
); };