| 1 |
import getIcon from '../../utils/get-icon'; |
| 2 |
import metadata from './block.json'; |
| 3 |
import deprecated from './deprecated'; |
| 4 |
import edit from './edit'; |
| 5 |
import save from './save'; |
| 6 |
import transforms from './transforms'; |
| 7 |
|
| 8 |
const { name } = metadata; |
| 9 |
|
| 10 |
export { metadata, name }; |
| 11 |
|
| 12 |
export const settings = { |
| 13 |
icon: getIcon('block-icon-box', true), |
| 14 |
ghostkit: { |
| 15 |
previewUrl: 'https://www.ghostkit.io/docs/blocks/icon/', |
| 16 |
customStylesCallback(attributes) { |
| 17 |
const styles = { |
| 18 |
'--gkt-icon-box--icon__font-size': undefined, |
| 19 |
'--gkt-icon-box--icon__color': |
| 20 |
attributes.iconColor || undefined, |
| 21 |
'&:hover': { |
| 22 |
'--gkt-icon-box--icon__color': |
| 23 |
attributes.hoverIconColor || undefined, |
| 24 |
}, |
| 25 |
}; |
| 26 |
|
| 27 |
if ( |
| 28 |
typeof attributes.iconSize !== 'undefined' && |
| 29 |
attributes.iconSize !== '' |
| 30 |
) { |
| 31 |
styles['--gkt-icon-box--icon__font-size'] = |
| 32 |
`${attributes.iconSize}px`; |
| 33 |
} |
| 34 |
|
| 35 |
return styles; |
| 36 |
}, |
| 37 |
}, |
| 38 |
example: { |
| 39 |
attributes: { |
| 40 |
icon: '<svg class="ghostkit-svg-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16.7813 9.75C16.7813 7.10939 14.6406 4.96875 12 4.96875C9.35939 4.96875 7.21875 7.10939 7.21875 9.75C7.21875 12.3906 9.35939 14.5312 12 14.5312C14.6406 14.5312 16.7813 12.3906 16.7813 9.75Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M8.15625 18C10.6023 19.25 13.3977 19.25 15.8437 18" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>', |
| 41 |
iconColor: '#0366d6', |
| 42 |
ghostkit: { |
| 43 |
id: 'example-icon-box', |
| 44 |
}, |
| 45 |
className: 'ghostkit-custom-example-icon-box', |
| 46 |
}, |
| 47 |
innerBlocks: [ |
| 48 |
{ |
| 49 |
name: 'core/paragraph', |
| 50 |
attributes: { |
| 51 |
content: |
| 52 |
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.', |
| 53 |
}, |
| 54 |
}, |
| 55 |
], |
| 56 |
}, |
| 57 |
edit, |
| 58 |
save, |
| 59 |
transforms, |
| 60 |
deprecated, |
| 61 |
}; |
| 62 |
|