Skip to content

Commit

Permalink
add deprecations for calendly and opentable blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Feb 21, 2020
1 parent 17ff7f2 commit 3f41ead
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
18 changes: 13 additions & 5 deletions extensions/blocks/calendly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import './editor.scss';

export const name = 'calendly';
export const title = __( 'Calendly', 'jetpack' );
const supports = {
align: true,
alignWide: false,
html: false,
};
export const settings = {
title,
description: __( 'Embed a calendar for customers to schedule appointments', 'jetpack' ),
Expand All @@ -29,11 +34,7 @@ export const settings = {
__( 'schedule', 'jetpack' ),
__( 'appointments', 'jetpack' ),
],
supports: {
align: true,
alignWide: false,
html: false,
},
supports,
edit,
save: ( { attributes: { url } } ) => (
<div>
Expand Down Expand Up @@ -61,4 +62,11 @@ export const settings = {
},
],
},
deprecated: [
{
attributes,
supports,
save: ( { attributes: { url } } ) => <a href={ url }>{ url }</a>,
},
],
};
25 changes: 20 additions & 5 deletions extensions/blocks/opentable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import './view.scss';
export const name = 'opentable';
export const title = __( 'OpenTable', 'jetpack' );
import { getAttributesFromEmbedCode, restRefRegex, ridRegex } from './utils';

const supports = {
align: true,
html: false,
};
export const settings = {
title,
description: __( 'Allow visitors to book a reservation with OpenTable', 'jetpack' ),
Expand All @@ -31,10 +34,7 @@ export const settings = {
__( 'reservation', 'jetpack' ),
__( 'restaurant', 'jetpack' ),
],
supports: {
align: true,
html: false,
},
supports,
edit,
save: ( { attributes: { rid } } ) => (
<div>
Expand Down Expand Up @@ -71,4 +71,19 @@ export const settings = {
},
],
},
deprecated: [
{
attributes: defaultAttributes,
supports,
save: ( { attributes: { rid } } ) => (
<>
{ rid.map( restaurantId => (
<a href={ `https://www.opentable.com/restref/client/?rid=${ restaurantId }` }>
{ `https://www.opentable.com/restref/client/?rid=${ restaurantId }` }
</a>
) ) }
</>
),
},
],
};

0 comments on commit 3f41ead

Please sign in to comment.