Server IP : 104.21.14.103 / Your IP : 18.191.168.10 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/home/giankuin/sieuthiweb.com.vn/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/components/panel/ |
Upload File : |
/** * External dependencies */ import { useState } from '@wordpress/element'; import classNames from 'classnames'; import PropTypes from 'prop-types'; import { Icon, chevronUp, chevronDown } from '@woocommerce/icons'; /** * Internal dependencies */ import './style.scss'; const Panel = ( { children, className, initialOpen = false, hasBorder = false, title, titleTag: TitleTag = 'div', } ) => { const [ isOpen, setIsOpen ] = useState( initialOpen ); return ( <div className={ classNames( className, 'wc-blocks-components-panel', { 'has-border': hasBorder, } ) } > <TitleTag> <button aria-expanded={ isOpen } className="wc-blocks-components-panel__button" onClick={ () => setIsOpen( ! isOpen ) } > <Icon aria-hidden="true" className="wc-blocks-components-panel__button-icon" srcElement={ isOpen ? chevronUp : chevronDown } /> { title } </button> </TitleTag> <div className="wc-blocks-components-panel__content" hidden={ ! isOpen } > { children } </div> </div> ); }; Panel.propTypes = { className: PropTypes.string, hasBorder: PropTypes.bool, initialOpen: PropTypes.bool, title: PropTypes.element, titleTag: PropTypes.string, }; export default Panel;