| 1 |
import getIcon from '../../utils/get-icon'; |
| 2 |
import metadata from './block.json'; |
| 3 |
import edit from './edit'; |
| 4 |
import save from './save'; |
| 5 |
|
| 6 |
const { name } = metadata; |
| 7 |
export { metadata, name }; |
| 8 |
|
| 9 |
export const settings = { |
| 10 |
icon: getIcon('block-icon', true), |
| 11 |
ghostkit: { |
| 12 |
previewUrl: 'https://www.ghostkit.io/docs/blocks/icon/', |
| 13 |
customStylesCallback(attributes) { |
| 14 |
const { |
| 15 |
justify, |
| 16 |
width, |
| 17 |
color, |
| 18 |
backgroundColor, |
| 19 |
backgroundGradient, |
| 20 |
} = attributes; |
| 21 |
const styles = { |
| 22 |
'--gkt-icon__color': color || undefined, |
| 23 |
'--gkt-icon__background': |
| 24 |
backgroundColor || backgroundGradient || undefined, |
| 25 |
'--gkt-icon__width': undefined, |
| 26 |
'--gkt-icon__justify': undefined, |
| 27 |
}; |
| 28 |
|
| 29 |
if (justify === 'start') { |
| 30 |
styles['--gkt-icon__justify'] = 'flex-start'; |
| 31 |
} else if (justify === 'end') { |
| 32 |
styles['--gkt-icon__justify'] = 'flex-end'; |
| 33 |
} |
| 34 |
|
| 35 |
if (typeof width !== 'undefined' && width !== '') { |
| 36 |
styles['--gkt-icon__width'] = width; |
| 37 |
} |
| 38 |
|
| 39 |
return styles; |
| 40 |
}, |
| 41 |
}, |
| 42 |
edit, |
| 43 |
save, |
| 44 |
}; |
| 45 |
|