| 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-counter-box', true), |
| 14 |
ghostkit: { |
| 15 |
previewUrl: 'https://www.ghostkit.io/docs/blocks/number-box/', |
| 16 |
customStylesCallback(attributes) { |
| 17 |
const styles = { |
| 18 |
'--gkt-counter-box--number__font-size': undefined, |
| 19 |
'--gkt-counter-box--number__color': |
| 20 |
attributes.numberColor || undefined, |
| 21 |
'&:hover': { |
| 22 |
'--gkt-counter-box--number__color': |
| 23 |
attributes.hoverNumberColor || undefined, |
| 24 |
}, |
| 25 |
}; |
| 26 |
|
| 27 |
if ( |
| 28 |
typeof attributes.numberSize !== 'undefined' && |
| 29 |
attributes.numberSize !== '' |
| 30 |
) { |
| 31 |
styles['--gkt-counter-box--number__font-size'] = |
| 32 |
`${attributes.numberSize}px`; |
| 33 |
} |
| 34 |
|
| 35 |
return styles; |
| 36 |
}, |
| 37 |
}, |
| 38 |
example: { |
| 39 |
attributes: { |
| 40 |
number: '77', |
| 41 |
numberColor: '#0366d6', |
| 42 |
ghostkit: { |
| 43 |
id: 'example-counter-box', |
| 44 |
}, |
| 45 |
className: 'ghostkit-custom-example-counter-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 |
|