import classnames from 'classnames'; import Controls from './controls'; import Edit from './edit'; import './editor.scss'; import icon from './icon'; import './style.scss'; const { __ } = wp.i18n; const { registerBlockType } = wp.blocks; const { Fragment } = wp.element; const { RichText, } = wp.editor; registerBlockType( 'advanced-blocks/pricing-table', { title: __( 'Pricing Table' ), category: 'advanced-blocks', description: __( 'Add a pricing table block to showcase different plans and offers.' ), icon, keywords: [ __( 'pricing table' ), __( 'comparison' ), ], customCategory: 'advanced-blocks', supports: { align: [ 'wide', 'full' ], }, attributes: { columns: { type: 'number', default: 2, }, featured_text: { type: 'string', default: 'Recommended', }, accent: { type: 'string', default: '#23282d', }, featuredAccent: { type: 'string', default: '#333333', }, textColor: { type: 'string', default: '#23282d', }, backgroundColor: { type: 'string', }, tables: { type: 'array', default: [], }, fullWidthButtons: { type: 'boolean', default: false, }, boxShadow: { type: 'boolean', default: true, }, }, edit( props ) { return ( ); }, save( props ) { const { attributes } = props; const className = 'wp-block-advanced-pricing-table'; const hasFeatured = attributes.tables.some( ( table ) => table.featured ); return (
{ ( attributes.tables.length ) ? ( attributes.tables.map( ( table, i ) => (
{ ( attributes.featured_text ) && ( table.featured ) && { attributes.featured_text } }
) ) ) : null }
); }, } );