| 1 |
import getIcon from '../../utils/get-icon'; |
| 2 |
import metadata from './block.json'; |
| 3 |
import edit from './edit'; |
| 4 |
import save from './save'; |
| 5 |
import transforms from './transforms'; |
| 6 |
|
| 7 |
const { name } = metadata; |
| 8 |
|
| 9 |
export { metadata, name }; |
| 10 |
|
| 11 |
export const settings = { |
| 12 |
icon: getIcon('block-divider', true), |
| 13 |
ghostkit: { |
| 14 |
previewUrl: 'https://www.ghostkit.io/docs/blocks/divider/', |
| 15 |
customStylesCallback(attributes) { |
| 16 |
const styles = { |
| 17 |
'--gkt-divider__border-width': undefined, |
| 18 |
'--gkt-divider__border-color': attributes.color, |
| 19 |
'--gkt-divider--icon__font-size': undefined, |
| 20 |
'--gkt-divider--icon__color': attributes.iconColor, |
| 21 |
'&:hover': { |
| 22 |
'--gkt-divider__border-color': |
| 23 |
attributes.hoverColor || undefined, |
| 24 |
'--gkt-divider--icon__color': |
| 25 |
attributes.hoverIconColor || undefined, |
| 26 |
}, |
| 27 |
}; |
| 28 |
|
| 29 |
if ( |
| 30 |
typeof attributes.size !== 'undefined' && |
| 31 |
attributes.size !== '' |
| 32 |
) { |
| 33 |
styles['--gkt-divider__border-width'] = `${attributes.size}px`; |
| 34 |
} |
| 35 |
if ( |
| 36 |
typeof attributes.iconSize !== 'undefined' && |
| 37 |
attributes.iconSize !== '' |
| 38 |
) { |
| 39 |
styles['--gkt-divider--icon__font-size'] = |
| 40 |
`${attributes.iconSize}px`; |
| 41 |
} |
| 42 |
|
| 43 |
return styles; |
| 44 |
}, |
| 45 |
}, |
| 46 |
example: { |
| 47 |
attributes: { |
| 48 |
size: 4, |
| 49 |
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>', |
| 50 |
iconSize: 40, |
| 51 |
color: '#a7a9ab', |
| 52 |
iconColor: '#a7a9ab', |
| 53 |
ghostkit: { |
| 54 |
id: 'example-divider', |
| 55 |
}, |
| 56 |
className: 'ghostkit-custom-example-divider', |
| 57 |
}, |
| 58 |
}, |
| 59 |
edit, |
| 60 |
save, |
| 61 |
transforms, |
| 62 |
}; |
| 63 |
|