Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetpack Blocks: new version of the blocks (13.1.0) for the 7.1 release #31045

Merged
merged 29 commits into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
16eb7f5
Implement image filters for tiled gallery block
sirreal Feb 18, 2019
788a0ee
Jetpack Blocks: move a new set of blocks in production
jeherve Feb 26, 2019
30282bf
Jetpack Blocks: tag new version of the blocks for the 7.1 release
jeherve Feb 26, 2019
93c5145
Contact Info: Fix/contact info fix sidebar (#31042)
enejb Feb 26, 2019
98c558f
Additional keywords for the Slideshow block. (#31038)
jeffersonrabb Feb 26, 2019
be77dcb
Improvement to Autoplay delay label. (#31039)
jeffersonrabb Feb 26, 2019
00075b8
Slideshow: Add New Uploads At End (#31046)
jeffersonrabb Feb 26, 2019
6bf700c
Contact Info: Add the ability to add the buisness hours block to the …
enejb Feb 26, 2019
d6a238a
Contact Info Block: Improve email validation (#31033)
enejb Feb 27, 2019
cbba4d6
Business hours: show 'closed' when data is incomplete for a given int…
roccotripaldi Feb 27, 2019
7ca9928
Contact Info Block: Split phone numbers into prefix and phone number …
enejb Feb 27, 2019
82f717d
WordAds block: Update icon (#31106)
sirreal Feb 28, 2019
ada224d
Business Hours: Update editor styles for consistency with UI elements
thomasguillot Feb 27, 2019
172079f
Business Hours Block: add search keywords (#31090)
roccotripaldi Feb 28, 2019
99c12a5
Related Posts: update the message displayed when no related posts (#3…
jeherve Feb 28, 2019
3c871db
Tiled Gallery: Remove i18n strings in save (#31119)
sirreal Mar 1, 2019
265d6b0
Form block: fix typo (#31139)
simison Mar 1, 2019
08a309b
Mailchimp: Placeholder Buttons (#31089)
jeffersonrabb Mar 1, 2019
9850bb1
Mailchimp: Form Element Spacing (#31142)
jeffersonrabb Mar 1, 2019
bf27170
Business hours block: use blockIcon in placeholder (#31143)
simison Mar 1, 2019
1d98d30
Fix: business hours validation (#31122)
roccotripaldi Mar 4, 2019
db6f20e
Tiled gallery block: camel case product name (#31184)
simison Mar 4, 2019
8837523
VideoPress: Disable re-usable block feature for video blocks (#31186)
mmtr Mar 4, 2019
527a4a3
Change contact info icon to account box (#31190)
gititon Mar 4, 2019
556b303
Deselect image on filter change
sirreal Mar 4, 2019
99ea6c4
Update filter icons
sirreal Mar 4, 2019
d1f401c
Slideshow: Replace Buttons With A Tags (#31175)
jeffersonrabb Mar 4, 2019
6ca73c8
Fix WordAds block alignment
sirreal Mar 4, 2019
7aa4bc3
Jetpack Blocks: update blocks for the final 7.1 release.
jeherve Mar 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { __ } from 'gutenberg/extensions/presets/jetpack/utils/i18n';
const defaultOpen = '09:00';
const defaultClose = '17:00';

class Day extends Component {
class DayEdit extends Component {
renderInterval = ( interval, intervalIndex ) => {
const { day } = this.props;
const { opening, closing } = interval;
Expand All @@ -30,6 +30,7 @@ class Day extends Component {
label={ __( 'Opening' ) }
value={ opening }
className="business-hours__open"
placeHolder={ defaultOpen }
onChange={ value => {
this.setHour( value, 'opening', intervalIndex );
} }
Expand All @@ -39,6 +40,7 @@ class Day extends Component {
label={ __( 'Closing' ) }
value={ closing }
className="business-hours__close"
placeHolder={ defaultClose }
onChange={ value => {
this.setHour( value, 'closing', intervalIndex );
} }
Expand All @@ -61,13 +63,7 @@ class Day extends Component {
<div className="business-hours__row business-hours-row__add">
<div className={ classNames( day.name, 'business-hours__day' ) }>&nbsp;</div>
<div className={ classNames( day.name, 'business-hours__hours' ) }>
<IconButton
isSmall
isLink
label={ __( 'Add Hours' ) }
icon="plus-alt"
onClick={ this.addInterval }
>
<IconButton isLink label={ __( 'Add Hours' ) } onClick={ this.addInterval }>
{ __( 'Add Hours' ) }
</IconButton>
</div>
Expand Down Expand Up @@ -201,4 +197,4 @@ class Day extends Component {
}
}

export default Day;
export default DayEdit;
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,48 @@ import { sprintf } from '@wordpress/i18n';
*/
import { _x } from 'gutenberg/extensions/presets/jetpack/utils/i18n';

class DaySave extends Component {
class DayPreview extends Component {
formatTime( time ) {
const { timeFormat } = this.props;
const [ hours, minutes ] = time.split( ':' );
const _date = new Date();
if ( ! hours || ! minutes ) {
return false;
}
_date.setHours( hours );
_date.setMinutes( minutes );
return date( timeFormat, _date );
}

renderInterval = ( interval, key ) => {
return (
! isEmpty( interval.opening ) &&
! isEmpty( interval.closing ) && (
<dd key={ key }>
{ sprintf(
_x( 'From %s to %s', 'from business opening hour to closing hour' ),
this.formatTime( interval.opening ),
this.formatTime( interval.closing )
) }
</dd>
)
<dd key={ key }>
{ sprintf(
_x( 'From %s to %s', 'from business opening hour to closing hour' ),
this.formatTime( interval.opening ),
this.formatTime( interval.closing )
) }
</dd>
);
};

render() {
const { day, localization } = this.props;
const hours = day.hours.filter(
// remove any malformed or empty intervals
interval => this.formatTime( interval.opening ) && this.formatTime( interval.closing )
);
return (
<Fragment>
<dt className={ day.name }>{ localization.days[ day.name ] }</dt>
{ isEmpty( day.hours ) ? (
{ isEmpty( hours ) ? (
<dd>{ _x( 'Closed', 'business is closed on a full day' ) }</dd>
) : (
day.hours.map( this.renderInterval )
hours.map( this.renderInterval )
) }
</Fragment>
);
}
}

export default DaySave;
export default DayPreview;
33 changes: 23 additions & 10 deletions client/gutenberg/extensions/business-hours/edit.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* External dependencies
*/
import { BlockIcon } from '@wordpress/editor';
import { Component } from '@wordpress/element';
import { Placeholder } from '@wordpress/components';
import apiFetch from '@wordpress/api-fetch';
Expand All @@ -10,8 +11,8 @@ import { __experimentalGetSettings } from '@wordpress/date';
/**
* Internal dependencies
*/
import Day from 'gutenberg/extensions/business-hours/components/day';
import DaySave from 'gutenberg/extensions/business-hours/components/day-save';
import DayEdit from 'gutenberg/extensions/business-hours/components/day-edit';
import DayPreview from 'gutenberg/extensions/business-hours/components/day-preview';
import { icon } from 'gutenberg/extensions/business-hours/index';
import { __ } from 'gutenberg/extensions/presets/jetpack/utils/i18n';

Expand Down Expand Up @@ -52,13 +53,22 @@ class BusinessHours extends Component {
}

render() {
const { attributes, className, isEdit, isSelected } = this.props;
const { attributes, className, isSelected } = this.props;
const { days } = attributes;
const { localization, hasFetched } = this.state;
const { startOfWeek } = localization;
const localizedWeek = days.concat( days.slice( 0, startOfWeek ) ).slice( startOfWeek );

if ( ! isEdit || ! isSelected ) {
if ( ! hasFetched ) {
return (
<Placeholder
icon={ <BlockIcon icon={ icon } /> }
label={ __( 'Loading business hours' ) }
/>
);
}

if ( ! isSelected ) {
const settings = __experimentalGetSettings();
const {
formats: { time },
Expand All @@ -67,21 +77,24 @@ class BusinessHours extends Component {
<dl className={ classNames( className, 'jetpack-business-hours' ) }>
{ localizedWeek.map( ( day, key ) => {
return (
<DaySave key={ key } day={ day } localization={ localization } timeFormat={ time } />
<DayPreview
key={ key }
day={ day }
localization={ localization }
timeFormat={ time }
/>
);
} ) }
</dl>
);
}

if ( ! hasFetched ) {
return <Placeholder icon={ icon } label={ __( 'Loading business hours' ) } />;
}

return (
<div className={ classNames( className, 'is-edit' ) }>
{ localizedWeek.map( ( day, key ) => {
return <Day key={ key } day={ day } localization={ localization } { ...this.props } />;
return (
<DayEdit key={ key } day={ day } localization={ localization } { ...this.props } />
);
} ) }
</div>
);
Expand Down
22 changes: 6 additions & 16 deletions client/gutenberg/extensions/business-hours/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ $break-small: 600px;

.business-hours__row {
display: flex;
align-items: center;

&.business-hours-row__add,
&.business-hours-row__closed {
Expand All @@ -22,8 +21,7 @@ $break-small: 600px;
align-items: baseline;

.business-hours__day-name {
width: 40%;
font-size: small;
width: 60%;
font-weight: bold;
overflow-x: hidden;
text-overflow: ellipsis;
Expand All @@ -33,10 +31,6 @@ $break-small: 600px;
.components-form-toggle {
margin-right: 4px;
}

.components-toggle-control__label {
font-size: smaller;
}
}

.business-hours__hours {
Expand All @@ -56,21 +50,16 @@ $break-small: 600px;

.components-base-control__label {
margin-bottom: 0;
font-size: smaller;
}

.components-text-control__input {
font-size: smaller;
padding: 4px;
}
}
}
}

.business-hours__remove {
width: 10%;
align-self: flex-end;
margin-bottom: 8px;
text-align: center;
margin-top: 16px;
width: 10%;
}

.business-hours-row__add button {
Expand All @@ -81,7 +70,8 @@ $break-small: 600px;
}

.business-hours__remove button {
display: inline;
display: block;
margin: 0 auto;
}

.business-hours-row__add .components-button.is-default:hover,
Expand Down
12 changes: 8 additions & 4 deletions client/gutenberg/extensions/business-hours/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Path } from '@wordpress/components';
/**
* Internal dependencies
*/
import { __ } from 'gutenberg/extensions/presets/jetpack/utils/i18n';
import { __, _x } from 'gutenberg/extensions/presets/jetpack/utils/i18n';
import renderMaterialIcon from 'gutenberg/extensions/presets/jetpack/utils/render-material-icon';

import './editor.scss';
Expand All @@ -30,7 +30,11 @@ export const settings = {
supports: {
html: true,
},

keywords: [
_x( 'opening hours', 'block search term' ),
_x( 'closing time', 'block search term' ),
_x( 'schedule', 'block search term' ),
],
attributes: {
days: {
type: 'array',
Expand Down Expand Up @@ -92,7 +96,7 @@ export const settings = {
},
},

edit: props => <BusinessHours { ...props } isEdit />,
edit: props => <BusinessHours { ...props } />,

save: props => <BusinessHours { ...props } />,
save: () => null,
};
2 changes: 1 addition & 1 deletion client/gutenberg/extensions/contact-form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export const childBlocks = [
title: __( 'Radio' ),
keywords: [ __( 'Choose' ), __( 'Select' ), __( 'Option' ) ],
description: __(
'Inpsired by radios, only one radio item can be selected at a time. Add several radio button items.'
'Inspired by radios, only one radio item can be selected at a time. Add several radio button items.'
),
icon: renderMaterialIcon(
<Fragment>
Expand Down
20 changes: 3 additions & 17 deletions client/gutenberg/extensions/contact-info/address/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
* External dependencies
*/
import classnames from 'classnames';
import { PlainText, InspectorControls } from '@wordpress/editor';
import { PlainText } from '@wordpress/editor';
import { Component, Fragment } from '@wordpress/element';
import { ToggleControl, PanelBody, ExternalLink } from '@wordpress/components';
import { ToggleControl } from '@wordpress/components';

/**
* Internal dependencies
*/
import { __ } from 'gutenberg/extensions/presets/jetpack/utils/i18n';
import ClipboardInput from 'gutenberg/extensions/presets/jetpack/utils/clipboard-input';
import { default as save, googleMapsUrl } from './save';
import { default as save } from './save';

class AddressEdit extends Component {
constructor( ...args ) {
Expand Down Expand Up @@ -116,19 +115,6 @@ class AddressEdit extends Component {
onKeyDown={ this.preventEnterKey }
/>
{ externalLink }
<InspectorControls>
<PanelBody title={ __( 'Link to Google Maps' ) }>
{ externalLink }
{ hasContent && <ClipboardInput link={ googleMapsUrl( this.props ) } /> }
{ hasContent && (
<div>
<ExternalLink href={ googleMapsUrl( this.props ) }>
{ __( 'Visit Google Maps' ) }
</ExternalLink>
</div>
) }
</PanelBody>
</InspectorControls>
</Fragment>
) }
</div>
Expand Down
22 changes: 12 additions & 10 deletions client/gutenberg/extensions/contact-info/address/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,37 @@ const Address = ( {
attributes: { address, addressLine2, addressLine3, city, region, postal, country },
} ) => (
<Fragment>
{ address && <div class="jetpack-address__address jetpack-address__address1">{ address }</div> }
{ address && (
<div className="jetpack-address__address jetpack-address__address1">{ address }</div>
) }
{ addressLine2 && (
<div class="jetpack-address__address jetpack-address__address2">{ addressLine2 }</div>
<div className="jetpack-address__address jetpack-address__address2">{ addressLine2 }</div>
) }
{ addressLine3 && (
<div class="jetpack-address__address jetpack-address__address3">{ addressLine3 }</div>
<div className="jetpack-address__address jetpack-address__address3">{ addressLine3 }</div>
) }
{ city && ! ( region || postal ) && <div class="jetpack-address__city">{ city }</div> }
{ city && ! ( region || postal ) && <div className="jetpack-address__city">{ city }</div> }
{ city && ( region || postal ) && (
<div>
{ [
<span class="jetpack-address__city">{ city }</span>,
<span className="jetpack-address__city">{ city }</span>,
', ',
<span class="jetpack-address__region">{ region }</span>,
<span className="jetpack-address__region">{ region }</span>,
' ',
<span class="jetpack-address__postal">{ postal }</span>,
<span className="jetpack-address__postal">{ postal }</span>,
] }
</div>
) }
{ ! city && ( region || postal ) && (
<div>
{ [
<span class="jetpack-address__region">{ region }</span>,
<span className="jetpack-address__region">{ region }</span>,
' ',
<span class="jetpack-address__postal">{ postal }</span>,
<span className="jetpack-address__postal">{ postal }</span>,
] }
</div>
) }
{ country && <div class="jetpack-address__country">{ country }</div> }
{ country && <div className="jetpack-address__country">{ country }</div> }
</Fragment>
);

Expand Down
1 change: 1 addition & 0 deletions client/gutenberg/extensions/contact-info/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const ALLOWED_BLOCKS = [
'jetpack/email',
'jetpack/phone',
'jetpack/map',
'jetpack/business-hours',
'core/paragraph',
'core/image',
'core/heading',
Expand Down
Loading