| 1 |
/** |
| 2 |
* External dependencies |
| 3 |
*/ |
| 4 |
import classnames from 'classnames'; |
| 5 |
|
| 6 |
/** |
| 7 |
* WordPress dependencies |
| 8 |
*/ |
| 9 |
const { |
| 10 |
Button, |
| 11 |
Dashicon, |
| 12 |
G, |
| 13 |
Path, |
| 14 |
SVG |
| 15 |
} = wp.components; |
| 16 |
|
| 17 |
function PanelButton({ label, icon, className, isBack, onClick }) { |
| 18 |
const classes = classnames( 'components-panel__body', 'components-panel__body-button', className, { 'visualizer-panel-back': isBack }); |
| 19 |
return ( |
| 20 |
<div className={ classes }> |
| 21 |
<h2 className="components-panel__body-title"> |
| 22 |
<Button |
| 23 |
className="components-panel__body-toggle" |
| 24 |
onClick={ onClick } |
| 25 |
> |
| 26 |
<SVG className="components-panel__arrow" width="24px" height="24px" viewBox="-12 -12 48 48" xmlns="http://www.w3.org/2000/svg"> |
| 27 |
<G><Path fill="none" d="M0,0h24v24H0V0z" /></G> |
| 28 |
<G><Path d="M7.41,8.59L12,13.17l4.59-4.58L18,10l-6,6l-6-6L7.41,8.59z" /></G> |
| 29 |
</SVG> |
| 30 |
{ icon && <Dashicon icon={ icon } className="components-panel__icon" /> } |
| 31 |
{ label } |
| 32 |
</Button> |
| 33 |
</h2> |
| 34 |
</div> |
| 35 |
); |
| 36 |
} |
| 37 |
|
| 38 |
export default PanelButton; |
| 39 |
|