| 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 |
|
| 8 |
export { metadata, name }; |
| 9 |
|
| 10 |
export const settings = { |
| 11 |
icon: getIcon('block-pricing-table', true), |
| 12 |
ghostkit: { |
| 13 |
previewUrl: 'https://www.ghostkit.io/docs/blocks/pricing-table/', |
| 14 |
customStylesCallback(attributes) { |
| 15 |
const { gap, gapCustom } = attributes; |
| 16 |
|
| 17 |
const styles = { |
| 18 |
'--gkt-pricing-table__gap': undefined, |
| 19 |
}; |
| 20 |
|
| 21 |
// Custom Gap. |
| 22 |
if ( |
| 23 |
gap === 'custom' && |
| 24 |
typeof gapCustom !== 'undefined' && |
| 25 |
gapCustom !== '' |
| 26 |
) { |
| 27 |
// we need to use `%` unit because of conflict with complex calc() and 0 value. |
| 28 |
const unit = gapCustom ? 'px' : '%'; |
| 29 |
|
| 30 |
styles['--gkt-pricing-table__gap'] = `${gapCustom}${unit}`; |
| 31 |
} |
| 32 |
|
| 33 |
return styles; |
| 34 |
}, |
| 35 |
}, |
| 36 |
example: { |
| 37 |
attributes: { |
| 38 |
count: 2, |
| 39 |
}, |
| 40 |
innerBlocks: [ |
| 41 |
{ |
| 42 |
name: 'ghostkit/pricing-table-item', |
| 43 |
attributes: { |
| 44 |
title: 'Standard', |
| 45 |
price: '$49', |
| 46 |
features: '<li>Feature 1</li><li>Feature 2</li>', |
| 47 |
showPopular: true, |
| 48 |
}, |
| 49 |
innerBlocks: [ |
| 50 |
{ |
| 51 |
name: 'ghostkit/button', |
| 52 |
attributes: { |
| 53 |
align: 'center', |
| 54 |
}, |
| 55 |
innerBlocks: [ |
| 56 |
{ |
| 57 |
name: 'ghostkit/button-single', |
| 58 |
attributes: { |
| 59 |
text: 'Purchase', |
| 60 |
}, |
| 61 |
}, |
| 62 |
], |
| 63 |
}, |
| 64 |
], |
| 65 |
}, |
| 66 |
{ |
| 67 |
name: 'ghostkit/pricing-table-item', |
| 68 |
attributes: { |
| 69 |
title: 'Developers', |
| 70 |
price: '$99', |
| 71 |
features: '<li>Feature 1</li><li>Feature 2</li>', |
| 72 |
}, |
| 73 |
innerBlocks: [ |
| 74 |
{ |
| 75 |
name: 'ghostkit/button', |
| 76 |
attributes: { |
| 77 |
align: 'center', |
| 78 |
}, |
| 79 |
innerBlocks: [ |
| 80 |
{ |
| 81 |
name: 'ghostkit/button-single', |
| 82 |
attributes: { |
| 83 |
text: 'Purchase', |
| 84 |
}, |
| 85 |
}, |
| 86 |
], |
| 87 |
}, |
| 88 |
], |
| 89 |
}, |
| 90 |
], |
| 91 |
}, |
| 92 |
edit, |
| 93 |
save, |
| 94 |
}; |
| 95 |
|