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

Testimonial Block #11723

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
36 changes: 36 additions & 0 deletions extensions/blocks/testimonial/edit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* External dependencies
*/
import { Component, Fragment } from '@wordpress/element';
import { TextControl } from '@wordpress/components';
import classnames from 'classnames';

/**
* Internal dependencies
*/
import { __ } from '../../utils/i18n';
Copy link
Member

@simison simison Mar 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to give heads up that we'll remove the custom i18n wrapper soon, in which point this can just be changed to @wordpress/i18n import. :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aight, #11743 is merged so this can be rewritten to:

import { __ } from '@wordpress/i18n';

__( 'My testimonial', 'jetpack' ); // note textdomain!


export default class TestimonialEdit extends Component {
onChangeAuthor = value => void this.props.setAttributes( { author: value } );

render() {
const { attributes, className, isSelected } = this.props;

return (
<Fragment>
<div
className={ classnames( className, {
'is-selected': isSelected,
} ) }
>
<TextControl
label={ __( 'Author Name' ) }
value={ attributes.author }
onChange={ this.onChangeAuthor }
type="text"
/>
</div>
</Fragment>
);
}
}
7 changes: 7 additions & 0 deletions extensions/blocks/testimonial/editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase; as of #11971 this has been moved to shared from utils.

import { name, settings } from '.';

registerJetpackBlock( name, settings );
Empty file.
34 changes: 34 additions & 0 deletions extensions/blocks/testimonial/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Internal dependencies
*/
import './editor.scss';
import TestimonialEdit from './edit';
import TestimonialSave from './save';
import { __ } from '../../utils/i18n';

export const name = 'testimonial';

export const settings = {
title: __( 'Testimonial' ),
description: __( '…' ),
icon: 'embed-photo',
category: 'jetpack',
keywords: [ __( 'testimonial' ) ],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to duplicate this if it's the name of the Block itself? Some useful alternative keywords could be

https://www.merriam-webster.com/thesaurus/testimonial

supports: {},
attributes: {
content: {
type: 'string',
},
author: {
type: 'string',
},
authorMediaUrl: {
type: 'string',
},
authorMediaId: {
type: 'number',
},
},
edit: TestimonialEdit,
save: TestimonialSave,
};
13 changes: 13 additions & 0 deletions extensions/blocks/testimonial/save.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* External dependencies
*/
//import { addQueryArgs } from '@wordpress/url';

/**
* Internal dependencies
*/
//import { __ } from '../../utils/i18n';

export default ( { attributes: { author }, className } ) => (
<div className={ className }>{ author }</div>
);
10 changes: 10 additions & 0 deletions extensions/blocks/testimonial/testimonial.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
/**
* Testimonial Block.
*
* @since 7.1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to bump this to 7.3

*
* @package Jetpack
*/

jetpack_register_block( 'jetpack/testimonial' );
1 change: 1 addition & 0 deletions extensions/setup/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
],
"beta": [
"seo",
"testimonial",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase; as of #11971 this file has been moved to extensions/index.json from setup.

"vr"
]
}