-
Notifications
You must be signed in to change notification settings - Fork 798
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
Testimonial Block #11723
Changes from 1 commit
929baf0
5cb0afd
a7f7260
fe32726
d1499d4
0f3d896
2fd44f2
9c49dcf
7384aa6
7b1fd1b
ab1a65a
c0c02a8
c497575
667c630
20c4792
3b899ba
4b8bdd9
196a7ee
939b461
7505419
ddef525
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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'; | ||
|
||
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> | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import registerJetpackBlock from '../../utils/register-jetpack-block'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rebase; as of #11971 this has been moved to |
||
import { name, settings } from '.'; | ||
|
||
registerJetpackBlock( name, settings ); |
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' ) ], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
supports: {}, | ||
attributes: { | ||
content: { | ||
type: 'string', | ||
}, | ||
author: { | ||
type: 'string', | ||
}, | ||
authorMediaUrl: { | ||
type: 'string', | ||
}, | ||
authorMediaId: { | ||
type: 'number', | ||
}, | ||
}, | ||
edit: TestimonialEdit, | ||
save: TestimonialSave, | ||
}; |
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> | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
/** | ||
* Testimonial Block. | ||
* | ||
* @since 7.1.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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' ); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
], | ||
"beta": [ | ||
"seo", | ||
"testimonial", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rebase; as of #11971 this file has been moved to |
||
"vr" | ||
] | ||
} |
There was a problem hiding this comment.
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. :-)There was a problem hiding this comment.
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: