| 1 |
import { PanelBody, BaseControl, CheckboxControl } from '@wordpress/components'; |
| 2 |
import { __ } from '@wordpress/i18n'; |
| 3 |
import { useThemeStore } from '../../state/theme'; |
| 4 |
import { AttributesPropsAndSetter } from '../../types'; |
| 5 |
|
| 6 |
export const ButtonsPanel = ({ |
| 7 |
attributes, |
| 8 |
setAttributes, |
| 9 |
}: AttributesPropsAndSetter & { bringAttentionToThemes?: boolean }) => { |
| 10 |
const { updateThemeHistory } = useThemeStore(); |
| 11 |
return ( |
| 12 |
<PanelBody title={__('Buttons', 'code-block-pro')} initialOpen={false}> |
| 13 |
<BaseControl id="code-block-pro-show-copy-button"> |
| 14 |
<CheckboxControl |
| 15 |
data-cy="copy-button" |
| 16 |
label={__('Copy Button', 'code-block-pro')} |
| 17 |
help={__( |
| 18 |
'Adds a button to copy the code', |
| 19 |
'code-block-pro', |
| 20 |
)} |
| 21 |
checked={attributes.copyButton} |
| 22 |
onChange={(value) => { |
| 23 |
setAttributes({ copyButton: value }); |
| 24 |
updateThemeHistory({ |
| 25 |
...attributes, |
| 26 |
copyButton: value, |
| 27 |
}); |
| 28 |
}} |
| 29 |
/> |
| 30 |
</BaseControl> |
| 31 |
</PanelBody> |
| 32 |
); |
| 33 |
}; |
| 34 |
|