-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbe7b98
commit 6930cf9
Showing
3 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/** | ||
* Custom Block Theme Styles | ||
*/ | ||
wp.blocks.registerBlockStyle('core/separator', { | ||
name: 'sendig-separator', | ||
label: wp.i18n.__('Sendig Separator', 'sendig'), | ||
is_default: true | ||
wp.blocks.registerBlockStyle( 'core/separator', { | ||
name: 'sendig-separator', | ||
label: wp.i18n.__( 'Sendig Separator', 'sendig' ), | ||
is_default: true | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { registerBlockExtension } from '@10up/block-components'; | ||
import { Button } from '@wordpress/components'; | ||
import { BlockControls } from '@wordpress/block-editor'; | ||
|
||
/** | ||
* BlockEdit | ||
* | ||
* a react component that will get mounted in the editor when the block | ||
* is selected. It is recommended to use Slots like `BlockControls` or | ||
* `InspectorControls` in here to put settings into the blocks | ||
* toolbar or sidebar. | ||
* | ||
* @param {object} props block props | ||
* @returns {JSX} | ||
*/ | ||
function BlockEdit(props) { | ||
console.log('Hello from Sendig!'); | ||
|
||
function handleClick() { | ||
console.log('Clicked from Sendig!'); | ||
} | ||
|
||
return ( | ||
<BlockControls> | ||
<Button | ||
variant="primary" | ||
onClick={ handleClick } | ||
> | ||
Click here | ||
</Button> | ||
</BlockControls> | ||
); | ||
} | ||
|
||
|
||
function generateClassNames(props) { | ||
|
||
} | ||
|
||
registerBlockExtension( | ||
'core/separator', | ||
{ | ||
extensionName: 'sendig-separator', | ||
attributes: { | ||
hasFlipDirection: { | ||
type: 'string', | ||
default: 'right', | ||
}, | ||
}, | ||
classNameGenerator: generateClassNames, | ||
Edit: BlockEdit, | ||
} | ||
); |