| 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 |
|
| 7 |
const { name } = metadata; |
| 8 |
|
| 9 |
export { metadata, name }; |
| 10 |
|
| 11 |
export const settings = { |
| 12 |
icon: getIcon('block-button', true), |
| 13 |
ghostkit: { |
| 14 |
customStylesCallback(attributes) { |
| 15 |
const styles = { |
| 16 |
'--gkt-button__background-color': attributes.color || undefined, |
| 17 |
'--gkt-button__color': attributes.textColor || undefined, |
| 18 |
'--gkt-button__border-radius': undefined, |
| 19 |
'--gkt-button__border-width': undefined, |
| 20 |
'--gkt-button__border-color': |
| 21 |
attributes.borderColor || undefined, |
| 22 |
'--gkt-button-hover__background-color': |
| 23 |
attributes.hoverColor || undefined, |
| 24 |
'--gkt-button-hover__color': |
| 25 |
attributes.hoverTextColor || undefined, |
| 26 |
'--gkt-button-hover__border-color': |
| 27 |
attributes.hoverBorderColor || undefined, |
| 28 |
'--gkt-button-focus__background-color': |
| 29 |
attributes.hoverColor || undefined, |
| 30 |
'--gkt-button-focus__color': |
| 31 |
attributes.hoverTextColor || undefined, |
| 32 |
'--gkt-button-focus__box-shadow': undefined, |
| 33 |
}; |
| 34 |
|
| 35 |
// Border. |
| 36 |
if ( |
| 37 |
typeof attributes.borderRadius !== 'undefined' && |
| 38 |
attributes.borderRadius !== '' |
| 39 |
) { |
| 40 |
styles['--gkt-button__border-radius'] = |
| 41 |
`${attributes.borderRadius}px`; |
| 42 |
} |
| 43 |
if ( |
| 44 |
typeof attributes.borderWeight !== 'undefined' && |
| 45 |
attributes.borderWeight !== '' |
| 46 |
) { |
| 47 |
styles['--gkt-button__border-width'] = |
| 48 |
`${attributes.borderWeight}px`; |
| 49 |
} |
| 50 |
|
| 51 |
// Box Shadow. |
| 52 |
if ( |
| 53 |
typeof attributes.focusOutlineWeight !== 'undefined' && |
| 54 |
attributes.focusOutlineColor |
| 55 |
) { |
| 56 |
styles['--gkt-button-focus__box-shadow'] = |
| 57 |
`0 0 0 ${attributes.focusOutlineWeight}px ${attributes.focusOutlineColor}`; |
| 58 |
} |
| 59 |
|
| 60 |
return styles; |
| 61 |
}, |
| 62 |
}, |
| 63 |
edit, |
| 64 |
save, |
| 65 |
deprecated, |
| 66 |
}; |
| 67 |
|