-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Showing
8 changed files
with
94 additions
and
0 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
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
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,13 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "core/navigation-overlay", | ||
"title": "Navigation Overlay", | ||
"category": "navigation, theme, design", | ||
"description": "Display your navigation in an overlay.", | ||
"supports": { | ||
"inserter": true | ||
}, | ||
"textdomain": "default", | ||
"attributes": {} | ||
} |
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,16 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useBlockProps } from '@wordpress/block-editor'; | ||
|
||
const NavigationOverlayEdit = () => { | ||
const props = useBlockProps(); | ||
|
||
return ( | ||
<> | ||
<div { ...props }>hello</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default NavigationOverlayEdit; |
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,15 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import initBlock from '../utils/init-block'; | ||
import metadata from './block.json'; | ||
import NavigationOverlayEdit from './edit'; | ||
|
||
const { name } = metadata; | ||
export { metadata, name }; | ||
|
||
export const settings = { | ||
edit: NavigationOverlayEdit, | ||
}; | ||
|
||
export const init = () => initBlock( { name, metadata, settings } ); |
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,32 @@ | ||
<?php | ||
/** | ||
* Server-side rendering of the `core/overlay` block. | ||
* | ||
* @package WordPress | ||
*/ | ||
|
||
/** | ||
* Registers the `core/navigation-overlay` block on the server. | ||
*/ | ||
function register_block_core_navigation_overlay() { | ||
register_block_type_from_metadata( | ||
__DIR__ . '/navigation-overlay', | ||
array( | ||
'render_callback' => 'render_block_core_navigation_overlay', | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* Renders the `core/navigation-overlay` block on the server. | ||
* | ||
* | ||
* @param array $attributes Block attributes. | ||
* | ||
* @return string Returns the output of the overlay. | ||
*/ | ||
function render_block_core_navigation_overlay( $attributes ) { | ||
return 'navigation overlay'; | ||
} | ||
|
||
add_action( 'init', 'register_block_core_navigation_overlay' ); |
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,6 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { init } from '.'; | ||
|
||
export default init(); |