import getIcon from '../../utils/get-icon'; import metadata from './block.json'; import edit from './edit'; import save from './save'; import transforms from './transforms'; const { name } = metadata; export { metadata, name }; export const settings = { icon: getIcon('block-buttons', true), ghostkit: { previewUrl: 'https://www.ghostkit.io/docs/blocks/button/', customStylesCallback(attributes) { const { gap, gapCustom, gapVerticalCustom } = attributes; const styles = { '--gkt-button__gap': undefined, '--gkt-button__gap-vertical': undefined, }; // Custom Gap. if (gap === 'custom') { if (typeof gapCustom !== 'undefined') { // we need to use `%` unit because of conflict with complex calc() and 0 value. const unit = gapCustom ? 'px' : '%'; styles['--gkt-button__gap'] = `${gapCustom}${unit}`; } if (typeof gapVerticalCustom !== 'undefined') { // we need to use `%` unit because of conflict with complex calc() and 0 value. const unit = gapVerticalCustom ? 'px' : '%'; styles['--gkt-button__gap-vertical'] = `${gapVerticalCustom}${unit}`; } } return styles; }, }, example: { attributes: { count: 2, align: 'center', gap: 'lg', }, innerBlocks: [ { name: 'ghostkit/button-single', attributes: { text: 'Button 1', size: 'xl', color: '#0366d6', ghostkit: { id: 'example-button-1', }, className: 'ghostkit-custom-example-button-1', }, }, { name: 'ghostkit/button-single', attributes: { text: 'Button 2', size: 'xl', color: '#2F1747', icon: '', borderRadius: 50, ghostkit: { id: 'example-button-2', }, className: 'ghostkit-custom-example-button-2', }, }, ], }, edit, save, transforms, };