import getIcon from '../../utils/get-icon'; import metadata from './block.json'; import edit from './edit'; import save from './save'; const { name } = metadata; export { metadata, name }; export const settings = { icon: getIcon('block-shape-divider', true), ghostkit: { previewUrl: 'https://www.ghostkit.io/docs/blocks/shape-divider/', customStylesCallback(attributes) { const styles = { '--gkt-shape-divider__color': attributes.color || undefined, svg: { width: undefined, height: undefined, }, media_sm: { svg: { width: undefined, height: undefined, }, }, media_md: { svg: { width: undefined, height: undefined, }, }, media_lg: { svg: { width: undefined, height: undefined, }, }, media_xl: { svg: { width: undefined, height: undefined, }, }, }; Object.keys(attributes).forEach((key) => { if ( typeof attributes[key] !== 'undefined' && attributes[key] !== '' ) { let prefix = key.split('_')[0]; let type = key.split('_')[1]; if (!type) { type = prefix; prefix = ''; } if (type && (type === 'height' || type === 'width')) { if (type === 'height' && prefix) { styles[`media_${prefix}`].svg.height = `${attributes[key]}px`; } else if (type === 'height') { styles.svg.height = `${attributes[key]}px`; } else if (type === 'width' && prefix) { styles[`media_${prefix}`].svg.width = `${attributes[key]}%`; } else if (type === 'width') { styles.svg.width = `${attributes[key]}%`; } } } }); return styles; }, }, example: { attributes: { svg: '', ghostkit: { id: 'example-shape-divider', }, className: 'ghostkit-custom-example-shape-divider', }, }, edit, save, };