From 12074f403aabfeed9a2964ee89123f0cd2df631d Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Fri, 29 Jan 2021 18:17:12 +0200 Subject: [PATCH 1/7] Posts Navigation --- lib/blocks.php | 1 + packages/block-library/src/index.js | 2 + .../src/posts-navigation/block.json | 22 ++++++ .../src/posts-navigation/edit.js | 53 ++++++++++++++ .../src/posts-navigation/index.js | 26 +++++++ .../src/posts-navigation/index.php | 72 +++++++++++++++++++ .../src/posts-navigation/variations.js | 42 +++++++++++ .../blocks/core__posts-navigation.html | 1 + .../blocks/core__posts-navigation.json | 13 ++++ .../blocks/core__posts-navigation.parsed.json | 20 ++++++ .../core__posts-navigation.serialized.html | 1 + packages/icons/src/index.js | 2 + .../src/library/posts-navigation-next.js | 12 ++++ .../src/library/posts-navigation-previous.js | 12 ++++ 14 files changed, 279 insertions(+) create mode 100644 packages/block-library/src/posts-navigation/block.json create mode 100644 packages/block-library/src/posts-navigation/edit.js create mode 100644 packages/block-library/src/posts-navigation/index.js create mode 100644 packages/block-library/src/posts-navigation/index.php create mode 100644 packages/block-library/src/posts-navigation/variations.js create mode 100644 packages/e2e-tests/fixtures/blocks/core__posts-navigation.html create mode 100644 packages/e2e-tests/fixtures/blocks/core__posts-navigation.json create mode 100644 packages/e2e-tests/fixtures/blocks/core__posts-navigation.parsed.json create mode 100644 packages/e2e-tests/fixtures/blocks/core__posts-navigation.serialized.html create mode 100644 packages/icons/src/library/posts-navigation-next.js create mode 100644 packages/icons/src/library/posts-navigation-previous.js diff --git a/lib/blocks.php b/lib/blocks.php index d1428770e3540..5b0684bf37dba 100644 --- a/lib/blocks.php +++ b/lib/blocks.php @@ -76,6 +76,7 @@ function gutenberg_reregister_core_block_types() { 'post-excerpt.php' => 'core/post-excerpt', 'post-featured-image.php' => 'core/post-featured-image', 'post-hierarchical-terms.php' => 'core/post-hierarchical-terms', + 'posts-navigation.php' => 'core/posts-navigation', 'post-tags.php' => 'core/post-tags', 'post-title.php' => 'core/post-title', 'query.php' => 'core/query', diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index 376757f2bfb87..dcbd01e8f6537 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -72,6 +72,7 @@ import * as queryPagination from './query-pagination'; import * as queryPaginationNext from './query-pagination-next'; import * as queryPaginationNumbers from './query-pagination-numbers'; import * as queryPaginationPrevious from './query-pagination-previous'; +import * as postsNavigation from './posts-navigation'; import * as postTitle from './post-title'; import * as postContent from './post-content'; import * as postAuthor from './post-author'; @@ -236,6 +237,7 @@ export const __experimentalRegisterExperimentalCoreBlocks = postFeaturedImage, postHierarchicalTerms, postTags, + postsNavigation, ] : [] ), ].forEach( registerBlock ); diff --git a/packages/block-library/src/posts-navigation/block.json b/packages/block-library/src/posts-navigation/block.json new file mode 100644 index 0000000000000..920d926947c9d --- /dev/null +++ b/packages/block-library/src/posts-navigation/block.json @@ -0,0 +1,22 @@ +{ + "apiVersion": 2, + "name": "core/posts-navigation", + "category": "design", + "attributes": { + "type": { + "type": "string", + "default": "next" + }, + "label": { + "type": "string" + }, + "showTitle": { + "type": "boolean", + "default": false + } + }, + "supports": { + "reusable": false, + "html": false + } +} diff --git a/packages/block-library/src/posts-navigation/edit.js b/packages/block-library/src/posts-navigation/edit.js new file mode 100644 index 0000000000000..6d36f76b4aff0 --- /dev/null +++ b/packages/block-library/src/posts-navigation/edit.js @@ -0,0 +1,53 @@ +/** + * WordPress dependencies + */ +import { ToggleControl, PanelBody } from '@wordpress/components'; +import { + InspectorControls, + RichText, + useBlockProps, +} from '@wordpress/block-editor'; +import { __ } from '@wordpress/i18n'; + +export default function PostNavigationNextEdit( { + attributes: { type, label, showTitle }, + setAttributes, +} ) { + const isNext = type === 'next'; + const placeholder = isNext ? __( 'Next' ) : __( 'Previous' ); + const ariaLabel = isNext + ? __( 'Next post link' ) + : __( 'Previous post link' ); + return ( + <> + + + + setAttributes( { + showTitle: ! showTitle, + } ) + } + /> + + +
+ + setAttributes( { label: newLabel } ) + } + /> +
+ + ); +} diff --git a/packages/block-library/src/posts-navigation/index.js b/packages/block-library/src/posts-navigation/index.js new file mode 100644 index 0000000000000..9cb7a54f0b3cd --- /dev/null +++ b/packages/block-library/src/posts-navigation/index.js @@ -0,0 +1,26 @@ +/** + * WordPress dependencies + */ +import { _x, __ } from '@wordpress/i18n'; + +/** + * Internal dependencies + */ +import metadata from './block.json'; +import edit from './edit'; +import variations from './variations'; + +const { name } = metadata; +export { metadata, name }; + +export const settings = { + title: _x( + 'Posts Navigation Link', + 'name of the block that displays the next or previous post link that is adjacent to the current post' + ), + description: __( + 'Displays the next or previous post link that is adjacent to the current post.' + ), + edit, + variations, +}; diff --git a/packages/block-library/src/posts-navigation/index.php b/packages/block-library/src/posts-navigation/index.php new file mode 100644 index 0000000000000..835a2a2ffd05c --- /dev/null +++ b/packages/block-library/src/posts-navigation/index.php @@ -0,0 +1,72 @@ + "posts-navigation-$navigation_type" ) ); + // Set default values. + $format = '%link'; + $link = 'next' === $navigation_type ? _x( 'Next', 'label for next post link', 'gutenberg' ) : _x( 'Previous', 'label for previous post link', 'gutenberg' ); + $label = ''; + // If a custom label is provided, make this a link. + // `$label` is used to prepend the provided label, if we want to show the page title as well. + if ( isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ) { + $label = "{$attributes['label']}"; + $link = $label; + } + + // If we want to also show the page title, make the page title a link and prepend the label. + if ( isset( $attributes['showTitle'] ) && $attributes['showTitle'] ) { + if ( $label ) { + $format = "$label %link"; + } + $link = '%title'; + } + + // Add the wrapper attributes through `next_post_link` or `previous_post_link` hook. + $filter_link_attributes = function( $link ) use ( $wrapper_attributes ) { + return str_replace( 'href=', "$wrapper_attributes href=", $link ); + }; + // The dynamic portion of the hook name and the function name, `$navigation_type`, + // refers to the type of adjacency, 'next' or 'previous'. + $get_link_function = "get_{$navigation_type}_post_link"; + add_filter( "{$navigation_type}_post_link", $filter_link_attributes ); + $content = $get_link_function( $format, $link ); + remove_filter( "{$navigation_type}_post_link", $filter_link_attributes ); + return $content; +} + +/** + * Registers the `core/posts-navigation` block on the server. + */ +function register_block_core_posts_navigation() { + register_block_type_from_metadata( + __DIR__ . '/posts-navigation', + array( + 'render_callback' => 'render_block_core_posts_navigation', + ) + ); +} +add_action( 'init', 'register_block_core_posts_navigation' ); diff --git a/packages/block-library/src/posts-navigation/variations.js b/packages/block-library/src/posts-navigation/variations.js new file mode 100644 index 0000000000000..17b79eb5c5db8 --- /dev/null +++ b/packages/block-library/src/posts-navigation/variations.js @@ -0,0 +1,42 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; +import { postsNavigationNext, postsNavigationPrevious } from '@wordpress/icons'; + +const variations = [ + { + isDefault: true, + name: 'posts-navigation-next', + title: __( 'Next post link' ), + description: __( + 'Displays the next post link that is adjacent to the current post.' + ), + icon: postsNavigationNext, + attributes: { type: 'next' }, + scope: [ 'inserter', 'transform' ], + }, + { + name: 'posts-navigation-previous', + title: __( 'Previous post link' ), + description: __( + 'Displays the previous post link that is adjacent to the current post.' + ), + icon: postsNavigationPrevious, + attributes: { type: 'previous' }, + scope: [ 'inserter', 'transform' ], + }, +]; + +/** + * Add `isActive` function to all `posts-navigation` variations, if not defined. + * `isActive` function is used to find a variation match from a created + * Block by providing its attributes. + */ +variations.forEach( ( variation ) => { + if ( variation.isActive ) return; + variation.isActive = ( blockAttributes, variationAttributes ) => + blockAttributes.type === variationAttributes.type; +} ); + +export default variations; diff --git a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.html b/packages/e2e-tests/fixtures/blocks/core__posts-navigation.html new file mode 100644 index 0000000000000..d5986be914609 --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__posts-navigation.html @@ -0,0 +1 @@ + diff --git a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.json b/packages/e2e-tests/fixtures/blocks/core__posts-navigation.json new file mode 100644 index 0000000000000..0030ecd0e5b4b --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__posts-navigation.json @@ -0,0 +1,13 @@ +[ + { + "clientId": "_clientId_0", + "name": "core/posts-navigation", + "isValid": true, + "attributes": { + "type": "next", + "showTitle": false + }, + "innerBlocks": [], + "originalContent": "" + } +] diff --git a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.parsed.json b/packages/e2e-tests/fixtures/blocks/core__posts-navigation.parsed.json new file mode 100644 index 0000000000000..38e27a11b6f2a --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__posts-navigation.parsed.json @@ -0,0 +1,20 @@ +[ + { + "blockName": "core/posts-navigation", + "attrs": { + "type": "next" + }, + "innerBlocks": [], + "innerHTML": "", + "innerContent": [] + }, + { + "blockName": null, + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n", + "innerContent": [ + "\n" + ] + } +] diff --git a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.serialized.html b/packages/e2e-tests/fixtures/blocks/core__posts-navigation.serialized.html new file mode 100644 index 0000000000000..3028d91ceffd3 --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__posts-navigation.serialized.html @@ -0,0 +1 @@ + diff --git a/packages/icons/src/index.js b/packages/icons/src/index.js index cb57309e37419..4b8910a83b72c 100644 --- a/packages/icons/src/index.js +++ b/packages/icons/src/index.js @@ -141,6 +141,8 @@ export { default as postExcerpt } from './library/post-excerpt'; export { default as postFeaturedImage } from './library/post-featured-image'; export { default as postList } from './library/post-list'; export { default as postTitle } from './library/post-title'; +export { default as postsNavigationPrevious } from './library/posts-navigation-previous'; +export { default as postsNavigationNext } from './library/posts-navigation-next'; export { default as preformatted } from './library/preformatted'; export { default as pullLeft } from './library/pull-left'; export { default as pullRight } from './library/pull-right'; diff --git a/packages/icons/src/library/posts-navigation-next.js b/packages/icons/src/library/posts-navigation-next.js new file mode 100644 index 0000000000000..0ed13ed43372a --- /dev/null +++ b/packages/icons/src/library/posts-navigation-next.js @@ -0,0 +1,12 @@ +/** + * WordPress dependencies + */ +import { SVG, Path } from '@wordpress/primitives'; + +const postsNavigationNext = ( + + + +); + +export default postsNavigationNext; diff --git a/packages/icons/src/library/posts-navigation-previous.js b/packages/icons/src/library/posts-navigation-previous.js new file mode 100644 index 0000000000000..954d184969db4 --- /dev/null +++ b/packages/icons/src/library/posts-navigation-previous.js @@ -0,0 +1,12 @@ +/** + * WordPress dependencies + */ +import { SVG, Path } from '@wordpress/primitives'; + +const postsNavigationPrevious = ( + + + +); + +export default postsNavigationPrevious; From df98f0b9b2f2b56312458a6b65e5f376a78e952e Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Mon, 1 Feb 2021 09:47:43 +0200 Subject: [PATCH 2/7] rename block --- lib/blocks.php | 2 +- packages/block-library/src/index.js | 4 ++-- .../block.json | 2 +- .../edit.js | 0 .../index.js | 2 +- .../index.php | 18 +++++++++--------- .../variations.js | 12 ++++++------ .../fixtures/blocks/core__post-navigation.html | 1 + ...igation.json => core__post-navigation.json} | 2 +- ....json => core__post-navigation.parsed.json} | 2 +- .../core__post-navigation.serialized.html | 1 + .../blocks/core__posts-navigation.html | 1 - .../core__posts-navigation.serialized.html | 1 - packages/icons/src/index.js | 4 ++-- ...igation-next.js => post-navigation-next.js} | 4 ++-- ...previous.js => post-navigation-previous.js} | 4 ++-- 16 files changed, 30 insertions(+), 30 deletions(-) rename packages/block-library/src/{posts-navigation => post-navigation}/block.json (89%) rename packages/block-library/src/{posts-navigation => post-navigation}/edit.js (100%) rename packages/block-library/src/{posts-navigation => post-navigation}/index.js (95%) rename packages/block-library/src/{posts-navigation => post-navigation}/index.php (80%) rename packages/block-library/src/{posts-navigation => post-navigation}/variations.js (75%) create mode 100644 packages/e2e-tests/fixtures/blocks/core__post-navigation.html rename packages/e2e-tests/fixtures/blocks/{core__posts-navigation.json => core__post-navigation.json} (84%) rename packages/e2e-tests/fixtures/blocks/{core__posts-navigation.parsed.json => core__post-navigation.parsed.json} (87%) create mode 100644 packages/e2e-tests/fixtures/blocks/core__post-navigation.serialized.html delete mode 100644 packages/e2e-tests/fixtures/blocks/core__posts-navigation.html delete mode 100644 packages/e2e-tests/fixtures/blocks/core__posts-navigation.serialized.html rename packages/icons/src/library/{posts-navigation-next.js => post-navigation-next.js} (79%) rename packages/icons/src/library/{posts-navigation-previous.js => post-navigation-previous.js} (77%) diff --git a/lib/blocks.php b/lib/blocks.php index 5b0684bf37dba..4d8cccec877a7 100644 --- a/lib/blocks.php +++ b/lib/blocks.php @@ -76,7 +76,7 @@ function gutenberg_reregister_core_block_types() { 'post-excerpt.php' => 'core/post-excerpt', 'post-featured-image.php' => 'core/post-featured-image', 'post-hierarchical-terms.php' => 'core/post-hierarchical-terms', - 'posts-navigation.php' => 'core/posts-navigation', + 'post-navigation.php' => 'core/post-navigation', 'post-tags.php' => 'core/post-tags', 'post-title.php' => 'core/post-title', 'query.php' => 'core/query', diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index dcbd01e8f6537..5c1ed3fa90bd1 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -72,7 +72,7 @@ import * as queryPagination from './query-pagination'; import * as queryPaginationNext from './query-pagination-next'; import * as queryPaginationNumbers from './query-pagination-numbers'; import * as queryPaginationPrevious from './query-pagination-previous'; -import * as postsNavigation from './posts-navigation'; +import * as postNavigation from './post-navigation'; import * as postTitle from './post-title'; import * as postContent from './post-content'; import * as postAuthor from './post-author'; @@ -237,7 +237,7 @@ export const __experimentalRegisterExperimentalCoreBlocks = postFeaturedImage, postHierarchicalTerms, postTags, - postsNavigation, + postNavigation, ] : [] ), ].forEach( registerBlock ); diff --git a/packages/block-library/src/posts-navigation/block.json b/packages/block-library/src/post-navigation/block.json similarity index 89% rename from packages/block-library/src/posts-navigation/block.json rename to packages/block-library/src/post-navigation/block.json index 920d926947c9d..5a315d307344f 100644 --- a/packages/block-library/src/posts-navigation/block.json +++ b/packages/block-library/src/post-navigation/block.json @@ -1,6 +1,6 @@ { "apiVersion": 2, - "name": "core/posts-navigation", + "name": "core/post-navigation", "category": "design", "attributes": { "type": { diff --git a/packages/block-library/src/posts-navigation/edit.js b/packages/block-library/src/post-navigation/edit.js similarity index 100% rename from packages/block-library/src/posts-navigation/edit.js rename to packages/block-library/src/post-navigation/edit.js diff --git a/packages/block-library/src/posts-navigation/index.js b/packages/block-library/src/post-navigation/index.js similarity index 95% rename from packages/block-library/src/posts-navigation/index.js rename to packages/block-library/src/post-navigation/index.js index 9cb7a54f0b3cd..93b07e51ce588 100644 --- a/packages/block-library/src/posts-navigation/index.js +++ b/packages/block-library/src/post-navigation/index.js @@ -15,7 +15,7 @@ export { metadata, name }; export const settings = { title: _x( - 'Posts Navigation Link', + 'Post Navigation Link', 'name of the block that displays the next or previous post link that is adjacent to the current post' ), description: __( diff --git a/packages/block-library/src/posts-navigation/index.php b/packages/block-library/src/post-navigation/index.php similarity index 80% rename from packages/block-library/src/posts-navigation/index.php rename to packages/block-library/src/post-navigation/index.php index 835a2a2ffd05c..7b107568d6360 100644 --- a/packages/block-library/src/posts-navigation/index.php +++ b/packages/block-library/src/post-navigation/index.php @@ -1,12 +1,12 @@ "posts-navigation-$navigation_type" ) ); + $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => "post-navigation-$navigation_type" ) ); // Set default values. $format = '%link'; $link = 'next' === $navigation_type ? _x( 'Next', 'label for next post link', 'gutenberg' ) : _x( 'Previous', 'label for previous post link', 'gutenberg' ); @@ -59,14 +59,14 @@ function render_block_core_posts_navigation( $attributes, $content, $block ) { } /** - * Registers the `core/posts-navigation` block on the server. + * Registers the `core/post-navigation` block on the server. */ -function register_block_core_posts_navigation() { +function register_block_core_post_navigation() { register_block_type_from_metadata( - __DIR__ . '/posts-navigation', + __DIR__ . '/post-navigation', array( - 'render_callback' => 'render_block_core_posts_navigation', + 'render_callback' => 'render_block_core_post_navigation', ) ); } -add_action( 'init', 'register_block_core_posts_navigation' ); +add_action( 'init', 'register_block_core_post_navigation' ); diff --git a/packages/block-library/src/posts-navigation/variations.js b/packages/block-library/src/post-navigation/variations.js similarity index 75% rename from packages/block-library/src/posts-navigation/variations.js rename to packages/block-library/src/post-navigation/variations.js index 17b79eb5c5db8..ab94e214166fa 100644 --- a/packages/block-library/src/posts-navigation/variations.js +++ b/packages/block-library/src/post-navigation/variations.js @@ -2,34 +2,34 @@ * WordPress dependencies */ import { __ } from '@wordpress/i18n'; -import { postsNavigationNext, postsNavigationPrevious } from '@wordpress/icons'; +import { postNavigationNext, postNavigationPrevious } from '@wordpress/icons'; const variations = [ { isDefault: true, - name: 'posts-navigation-next', + name: 'post-navigation-next', title: __( 'Next post link' ), description: __( 'Displays the next post link that is adjacent to the current post.' ), - icon: postsNavigationNext, + icon: postNavigationNext, attributes: { type: 'next' }, scope: [ 'inserter', 'transform' ], }, { - name: 'posts-navigation-previous', + name: 'post-navigation-previous', title: __( 'Previous post link' ), description: __( 'Displays the previous post link that is adjacent to the current post.' ), - icon: postsNavigationPrevious, + icon: postNavigationPrevious, attributes: { type: 'previous' }, scope: [ 'inserter', 'transform' ], }, ]; /** - * Add `isActive` function to all `posts-navigation` variations, if not defined. + * Add `isActive` function to all `post-navigation` variations, if not defined. * `isActive` function is used to find a variation match from a created * Block by providing its attributes. */ diff --git a/packages/e2e-tests/fixtures/blocks/core__post-navigation.html b/packages/e2e-tests/fixtures/blocks/core__post-navigation.html new file mode 100644 index 0000000000000..c4ea8c60ab419 --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__post-navigation.html @@ -0,0 +1 @@ + diff --git a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.json b/packages/e2e-tests/fixtures/blocks/core__post-navigation.json similarity index 84% rename from packages/e2e-tests/fixtures/blocks/core__posts-navigation.json rename to packages/e2e-tests/fixtures/blocks/core__post-navigation.json index 0030ecd0e5b4b..8076d57fc76cb 100644 --- a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.json +++ b/packages/e2e-tests/fixtures/blocks/core__post-navigation.json @@ -1,7 +1,7 @@ [ { "clientId": "_clientId_0", - "name": "core/posts-navigation", + "name": "core/post-navigation", "isValid": true, "attributes": { "type": "next", diff --git a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.parsed.json b/packages/e2e-tests/fixtures/blocks/core__post-navigation.parsed.json similarity index 87% rename from packages/e2e-tests/fixtures/blocks/core__posts-navigation.parsed.json rename to packages/e2e-tests/fixtures/blocks/core__post-navigation.parsed.json index 38e27a11b6f2a..7d00b9cb22c19 100644 --- a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.parsed.json +++ b/packages/e2e-tests/fixtures/blocks/core__post-navigation.parsed.json @@ -1,6 +1,6 @@ [ { - "blockName": "core/posts-navigation", + "blockName": "core/post-navigation", "attrs": { "type": "next" }, diff --git a/packages/e2e-tests/fixtures/blocks/core__post-navigation.serialized.html b/packages/e2e-tests/fixtures/blocks/core__post-navigation.serialized.html new file mode 100644 index 0000000000000..5ba5a1dbfc4f1 --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__post-navigation.serialized.html @@ -0,0 +1 @@ + diff --git a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.html b/packages/e2e-tests/fixtures/blocks/core__posts-navigation.html deleted file mode 100644 index d5986be914609..0000000000000 --- a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.serialized.html b/packages/e2e-tests/fixtures/blocks/core__posts-navigation.serialized.html deleted file mode 100644 index 3028d91ceffd3..0000000000000 --- a/packages/e2e-tests/fixtures/blocks/core__posts-navigation.serialized.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/icons/src/index.js b/packages/icons/src/index.js index 4b8910a83b72c..f2bff159c1df0 100644 --- a/packages/icons/src/index.js +++ b/packages/icons/src/index.js @@ -141,8 +141,8 @@ export { default as postExcerpt } from './library/post-excerpt'; export { default as postFeaturedImage } from './library/post-featured-image'; export { default as postList } from './library/post-list'; export { default as postTitle } from './library/post-title'; -export { default as postsNavigationPrevious } from './library/posts-navigation-previous'; -export { default as postsNavigationNext } from './library/posts-navigation-next'; +export { default as postNavigationPrevious } from './library/post-navigation-previous'; +export { default as postNavigationNext } from './library/post-navigation-next'; export { default as preformatted } from './library/preformatted'; export { default as pullLeft } from './library/pull-left'; export { default as pullRight } from './library/pull-right'; diff --git a/packages/icons/src/library/posts-navigation-next.js b/packages/icons/src/library/post-navigation-next.js similarity index 79% rename from packages/icons/src/library/posts-navigation-next.js rename to packages/icons/src/library/post-navigation-next.js index 0ed13ed43372a..1678a7f51758a 100644 --- a/packages/icons/src/library/posts-navigation-next.js +++ b/packages/icons/src/library/post-navigation-next.js @@ -3,10 +3,10 @@ */ import { SVG, Path } from '@wordpress/primitives'; -const postsNavigationNext = ( +const postNavigationNext = ( ); -export default postsNavigationNext; +export default postNavigationNext; diff --git a/packages/icons/src/library/posts-navigation-previous.js b/packages/icons/src/library/post-navigation-previous.js similarity index 77% rename from packages/icons/src/library/posts-navigation-previous.js rename to packages/icons/src/library/post-navigation-previous.js index 954d184969db4..8bab0c2eb6e3b 100644 --- a/packages/icons/src/library/posts-navigation-previous.js +++ b/packages/icons/src/library/post-navigation-previous.js @@ -3,10 +3,10 @@ */ import { SVG, Path } from '@wordpress/primitives'; -const postsNavigationPrevious = ( +const postNavigationPrevious = ( ); -export default postsNavigationPrevious; +export default postNavigationPrevious; From fcd87c1558f4ba2c61c029a71add07dd2324a675 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Mon, 1 Feb 2021 11:54:14 +0200 Subject: [PATCH 3/7] rename to post-navigation-link --- lib/blocks.php | 2 +- packages/block-library/src/index.js | 4 ++-- .../block.json | 2 +- .../edit.js | 0 .../index.js | 0 .../index.php | 18 +++++++++--------- .../variations.js | 15 +++++++++------ .../blocks/core__post-navigation-link.html | 1 + ...on.json => core__post-navigation-link.json} | 2 +- ... => core__post-navigation-link.parsed.json} | 2 +- .../core__post-navigation-link.serialized.html | 1 + .../fixtures/blocks/core__post-navigation.html | 1 - .../core__post-navigation.serialized.html | 1 - packages/icons/src/index.js | 4 ++-- ...on-next.js => post-navigation-link-next.js} | 4 ++-- ...ous.js => post-navigation-link-previous.js} | 4 ++-- 16 files changed, 32 insertions(+), 29 deletions(-) rename packages/block-library/src/{post-navigation => post-navigation-link}/block.json (88%) rename packages/block-library/src/{post-navigation => post-navigation-link}/edit.js (100%) rename packages/block-library/src/{post-navigation => post-navigation-link}/index.js (100%) rename packages/block-library/src/{post-navigation => post-navigation-link}/index.php (79%) rename packages/block-library/src/{post-navigation => post-navigation-link}/variations.js (73%) create mode 100644 packages/e2e-tests/fixtures/blocks/core__post-navigation-link.html rename packages/e2e-tests/fixtures/blocks/{core__post-navigation.json => core__post-navigation-link.json} (83%) rename packages/e2e-tests/fixtures/blocks/{core__post-navigation.parsed.json => core__post-navigation-link.parsed.json} (86%) create mode 100644 packages/e2e-tests/fixtures/blocks/core__post-navigation-link.serialized.html delete mode 100644 packages/e2e-tests/fixtures/blocks/core__post-navigation.html delete mode 100644 packages/e2e-tests/fixtures/blocks/core__post-navigation.serialized.html rename packages/icons/src/library/{post-navigation-next.js => post-navigation-link-next.js} (78%) rename packages/icons/src/library/{post-navigation-previous.js => post-navigation-link-previous.js} (76%) diff --git a/lib/blocks.php b/lib/blocks.php index 4d8cccec877a7..cc74ce7bbabb7 100644 --- a/lib/blocks.php +++ b/lib/blocks.php @@ -76,7 +76,7 @@ function gutenberg_reregister_core_block_types() { 'post-excerpt.php' => 'core/post-excerpt', 'post-featured-image.php' => 'core/post-featured-image', 'post-hierarchical-terms.php' => 'core/post-hierarchical-terms', - 'post-navigation.php' => 'core/post-navigation', + 'post-navigation-link.php' => 'core/post-navigation-link', 'post-tags.php' => 'core/post-tags', 'post-title.php' => 'core/post-title', 'query.php' => 'core/query', diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index 5c1ed3fa90bd1..9499eb4ef3e90 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -72,7 +72,7 @@ import * as queryPagination from './query-pagination'; import * as queryPaginationNext from './query-pagination-next'; import * as queryPaginationNumbers from './query-pagination-numbers'; import * as queryPaginationPrevious from './query-pagination-previous'; -import * as postNavigation from './post-navigation'; +import * as postNavigationLink from './post-navigation-link'; import * as postTitle from './post-title'; import * as postContent from './post-content'; import * as postAuthor from './post-author'; @@ -237,7 +237,7 @@ export const __experimentalRegisterExperimentalCoreBlocks = postFeaturedImage, postHierarchicalTerms, postTags, - postNavigation, + postNavigationLink, ] : [] ), ].forEach( registerBlock ); diff --git a/packages/block-library/src/post-navigation/block.json b/packages/block-library/src/post-navigation-link/block.json similarity index 88% rename from packages/block-library/src/post-navigation/block.json rename to packages/block-library/src/post-navigation-link/block.json index 5a315d307344f..d0d4023d2d91d 100644 --- a/packages/block-library/src/post-navigation/block.json +++ b/packages/block-library/src/post-navigation-link/block.json @@ -1,6 +1,6 @@ { "apiVersion": 2, - "name": "core/post-navigation", + "name": "core/post-navigation-link", "category": "design", "attributes": { "type": { diff --git a/packages/block-library/src/post-navigation/edit.js b/packages/block-library/src/post-navigation-link/edit.js similarity index 100% rename from packages/block-library/src/post-navigation/edit.js rename to packages/block-library/src/post-navigation-link/edit.js diff --git a/packages/block-library/src/post-navigation/index.js b/packages/block-library/src/post-navigation-link/index.js similarity index 100% rename from packages/block-library/src/post-navigation/index.js rename to packages/block-library/src/post-navigation-link/index.js diff --git a/packages/block-library/src/post-navigation/index.php b/packages/block-library/src/post-navigation-link/index.php similarity index 79% rename from packages/block-library/src/post-navigation/index.php rename to packages/block-library/src/post-navigation-link/index.php index 7b107568d6360..2882e592b87a1 100644 --- a/packages/block-library/src/post-navigation/index.php +++ b/packages/block-library/src/post-navigation-link/index.php @@ -1,12 +1,12 @@ "post-navigation-$navigation_type" ) ); + $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => "post-navigation-link-$navigation_type" ) ); // Set default values. $format = '%link'; $link = 'next' === $navigation_type ? _x( 'Next', 'label for next post link', 'gutenberg' ) : _x( 'Previous', 'label for previous post link', 'gutenberg' ); @@ -59,14 +59,14 @@ function render_block_core_post_navigation( $attributes, $content, $block ) { } /** - * Registers the `core/post-navigation` block on the server. + * Registers the `core/post-navigation-link` block on the server. */ -function register_block_core_post_navigation() { +function register_block_core_post_navigation_link() { register_block_type_from_metadata( - __DIR__ . '/post-navigation', + __DIR__ . '/post-navigation-link', array( - 'render_callback' => 'render_block_core_post_navigation', + 'render_callback' => 'render_block_core_post_navigation_link', ) ); } -add_action( 'init', 'register_block_core_post_navigation' ); +add_action( 'init', 'register_block_core_post_navigation_link' ); diff --git a/packages/block-library/src/post-navigation/variations.js b/packages/block-library/src/post-navigation-link/variations.js similarity index 73% rename from packages/block-library/src/post-navigation/variations.js rename to packages/block-library/src/post-navigation-link/variations.js index ab94e214166fa..b55ef7a34c568 100644 --- a/packages/block-library/src/post-navigation/variations.js +++ b/packages/block-library/src/post-navigation-link/variations.js @@ -2,34 +2,37 @@ * WordPress dependencies */ import { __ } from '@wordpress/i18n'; -import { postNavigationNext, postNavigationPrevious } from '@wordpress/icons'; +import { + postNavigationLinkNext, + postNavigationLinkPrevious, +} from '@wordpress/icons'; const variations = [ { isDefault: true, - name: 'post-navigation-next', + name: 'post-navigation-link-next', title: __( 'Next post link' ), description: __( 'Displays the next post link that is adjacent to the current post.' ), - icon: postNavigationNext, + icon: postNavigationLinkNext, attributes: { type: 'next' }, scope: [ 'inserter', 'transform' ], }, { - name: 'post-navigation-previous', + name: 'post-navigation-link-previous', title: __( 'Previous post link' ), description: __( 'Displays the previous post link that is adjacent to the current post.' ), - icon: postNavigationPrevious, + icon: postNavigationLinkPrevious, attributes: { type: 'previous' }, scope: [ 'inserter', 'transform' ], }, ]; /** - * Add `isActive` function to all `post-navigation` variations, if not defined. + * Add `isActive` function to all `post-navigation-link` variations, if not defined. * `isActive` function is used to find a variation match from a created * Block by providing its attributes. */ diff --git a/packages/e2e-tests/fixtures/blocks/core__post-navigation-link.html b/packages/e2e-tests/fixtures/blocks/core__post-navigation-link.html new file mode 100644 index 0000000000000..7708d3714548e --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__post-navigation-link.html @@ -0,0 +1 @@ + diff --git a/packages/e2e-tests/fixtures/blocks/core__post-navigation.json b/packages/e2e-tests/fixtures/blocks/core__post-navigation-link.json similarity index 83% rename from packages/e2e-tests/fixtures/blocks/core__post-navigation.json rename to packages/e2e-tests/fixtures/blocks/core__post-navigation-link.json index 8076d57fc76cb..817766c3fa35d 100644 --- a/packages/e2e-tests/fixtures/blocks/core__post-navigation.json +++ b/packages/e2e-tests/fixtures/blocks/core__post-navigation-link.json @@ -1,7 +1,7 @@ [ { "clientId": "_clientId_0", - "name": "core/post-navigation", + "name": "core/post-navigation-link", "isValid": true, "attributes": { "type": "next", diff --git a/packages/e2e-tests/fixtures/blocks/core__post-navigation.parsed.json b/packages/e2e-tests/fixtures/blocks/core__post-navigation-link.parsed.json similarity index 86% rename from packages/e2e-tests/fixtures/blocks/core__post-navigation.parsed.json rename to packages/e2e-tests/fixtures/blocks/core__post-navigation-link.parsed.json index 7d00b9cb22c19..5f584ca610359 100644 --- a/packages/e2e-tests/fixtures/blocks/core__post-navigation.parsed.json +++ b/packages/e2e-tests/fixtures/blocks/core__post-navigation-link.parsed.json @@ -1,6 +1,6 @@ [ { - "blockName": "core/post-navigation", + "blockName": "core/post-navigation-link", "attrs": { "type": "next" }, diff --git a/packages/e2e-tests/fixtures/blocks/core__post-navigation-link.serialized.html b/packages/e2e-tests/fixtures/blocks/core__post-navigation-link.serialized.html new file mode 100644 index 0000000000000..0cb6486520da8 --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__post-navigation-link.serialized.html @@ -0,0 +1 @@ + diff --git a/packages/e2e-tests/fixtures/blocks/core__post-navigation.html b/packages/e2e-tests/fixtures/blocks/core__post-navigation.html deleted file mode 100644 index c4ea8c60ab419..0000000000000 --- a/packages/e2e-tests/fixtures/blocks/core__post-navigation.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/e2e-tests/fixtures/blocks/core__post-navigation.serialized.html b/packages/e2e-tests/fixtures/blocks/core__post-navigation.serialized.html deleted file mode 100644 index 5ba5a1dbfc4f1..0000000000000 --- a/packages/e2e-tests/fixtures/blocks/core__post-navigation.serialized.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/icons/src/index.js b/packages/icons/src/index.js index f2bff159c1df0..25e3c3690b997 100644 --- a/packages/icons/src/index.js +++ b/packages/icons/src/index.js @@ -141,8 +141,8 @@ export { default as postExcerpt } from './library/post-excerpt'; export { default as postFeaturedImage } from './library/post-featured-image'; export { default as postList } from './library/post-list'; export { default as postTitle } from './library/post-title'; -export { default as postNavigationPrevious } from './library/post-navigation-previous'; -export { default as postNavigationNext } from './library/post-navigation-next'; +export { default as postNavigationLinkPrevious } from './library/post-navigation-link-previous'; +export { default as postNavigationLinkNext } from './library/post-navigation-link-next'; export { default as preformatted } from './library/preformatted'; export { default as pullLeft } from './library/pull-left'; export { default as pullRight } from './library/pull-right'; diff --git a/packages/icons/src/library/post-navigation-next.js b/packages/icons/src/library/post-navigation-link-next.js similarity index 78% rename from packages/icons/src/library/post-navigation-next.js rename to packages/icons/src/library/post-navigation-link-next.js index 1678a7f51758a..34b0a863131d8 100644 --- a/packages/icons/src/library/post-navigation-next.js +++ b/packages/icons/src/library/post-navigation-link-next.js @@ -3,10 +3,10 @@ */ import { SVG, Path } from '@wordpress/primitives'; -const postNavigationNext = ( +const postNavigationLinkNext = ( ); -export default postNavigationNext; +export default postNavigationLinkNext; diff --git a/packages/icons/src/library/post-navigation-previous.js b/packages/icons/src/library/post-navigation-link-previous.js similarity index 76% rename from packages/icons/src/library/post-navigation-previous.js rename to packages/icons/src/library/post-navigation-link-previous.js index 8bab0c2eb6e3b..aaf5229150c12 100644 --- a/packages/icons/src/library/post-navigation-previous.js +++ b/packages/icons/src/library/post-navigation-link-previous.js @@ -3,10 +3,10 @@ */ import { SVG, Path } from '@wordpress/primitives'; -const postNavigationPrevious = ( +const postNavigationLinkPrevious = ( ); -export default postNavigationPrevious; +export default postNavigationLinkPrevious; From 45b0b85e1a06a550e09b3aee9d110f6f5848cf8c Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Tue, 2 Feb 2021 09:03:21 +0200 Subject: [PATCH 4/7] copy change --- packages/block-library/src/post-navigation-link/variations.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/post-navigation-link/variations.js b/packages/block-library/src/post-navigation-link/variations.js index b55ef7a34c568..4812e30466687 100644 --- a/packages/block-library/src/post-navigation-link/variations.js +++ b/packages/block-library/src/post-navigation-link/variations.js @@ -13,7 +13,7 @@ const variations = [ name: 'post-navigation-link-next', title: __( 'Next post link' ), description: __( - 'Displays the next post link that is adjacent to the current post.' + 'Displays the post link that follows the current post.' ), icon: postNavigationLinkNext, attributes: { type: 'next' }, @@ -23,7 +23,7 @@ const variations = [ name: 'post-navigation-link-previous', title: __( 'Previous post link' ), description: __( - 'Displays the previous post link that is adjacent to the current post.' + 'Displays the post link that precedes the current post.' ), icon: postNavigationLinkPrevious, attributes: { type: 'previous' }, From 00f4d2327ddc14f26d8a5ba20e141be5139749ee Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Thu, 4 Feb 2021 13:22:37 +0200 Subject: [PATCH 5/7] keep placeholder on focus --- packages/block-library/src/post-navigation-link/edit.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index 6d36f76b4aff0..f7014ed38fe3c 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -46,6 +46,7 @@ export default function PostNavigationNextEdit( { onChange={ ( newLabel ) => setAttributes( { label: newLabel } ) } + keepPlaceholderOnFocus /> From 5daadacef231e02db69d3d403c067f0808ac9316 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Thu, 4 Feb 2021 14:07:23 +0200 Subject: [PATCH 6/7] add textAlign and fix front-end output to include all the block's content --- .../src/post-navigation-link/block.json | 3 +++ .../src/post-navigation-link/edit.js | 24 +++++++++++++++++-- .../src/post-navigation-link/index.php | 23 +++++++++--------- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/packages/block-library/src/post-navigation-link/block.json b/packages/block-library/src/post-navigation-link/block.json index d0d4023d2d91d..549aa469c1f79 100644 --- a/packages/block-library/src/post-navigation-link/block.json +++ b/packages/block-library/src/post-navigation-link/block.json @@ -3,6 +3,9 @@ "name": "core/post-navigation-link", "category": "design", "attributes": { + "textAlign": { + "type": "string" + }, "type": { "type": "string", "default": "next" diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index f7014ed38fe3c..1026eb0fcc3cf 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -1,3 +1,8 @@ +/** + * External dependencies + */ +import classnames from 'classnames'; + /** * WordPress dependencies */ @@ -5,12 +10,14 @@ import { ToggleControl, PanelBody } from '@wordpress/components'; import { InspectorControls, RichText, + BlockControls, + AlignmentToolbar, useBlockProps, } from '@wordpress/block-editor'; import { __ } from '@wordpress/i18n'; export default function PostNavigationNextEdit( { - attributes: { type, label, showTitle }, + attributes: { type, label, showTitle, textAlign }, setAttributes, } ) { const isNext = type === 'next'; @@ -18,6 +25,11 @@ export default function PostNavigationNextEdit( { const ariaLabel = isNext ? __( 'Next post link' ) : __( 'Previous post link' ); + const blockProps = useBlockProps( { + className: classnames( { + [ `has-text-align-${ textAlign }` ]: textAlign, + } ), + } ); return ( <> @@ -36,7 +48,15 @@ export default function PostNavigationNextEdit( { /> -
+ + { + setAttributes( { textAlign: nextAlign } ); + } } + /> + +
"post-navigation-link-$navigation_type" ) ); + $classes = "post-navigation-link-$navigation_type"; + if ( isset( $attributes['textAlign'] ) ) { + $classes .= " has-text-align-{$attributes['textAlign']}"; + } + $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); // Set default values. $format = '%link'; $link = 'next' === $navigation_type ? _x( 'Next', 'label for next post link', 'gutenberg' ) : _x( 'Previous', 'label for previous post link', 'gutenberg' ); @@ -44,18 +48,15 @@ function render_block_core_post_navigation_link( $attributes, $content, $block ) } $link = '%title'; } - - // Add the wrapper attributes through `next_post_link` or `previous_post_link` hook. - $filter_link_attributes = function( $link ) use ( $wrapper_attributes ) { - return str_replace( 'href=', "$wrapper_attributes href=", $link ); - }; - // The dynamic portion of the hook name and the function name, `$navigation_type`, + // The dynamic portion of the function name, `$navigation_type`, // refers to the type of adjacency, 'next' or 'previous'. $get_link_function = "get_{$navigation_type}_post_link"; - add_filter( "{$navigation_type}_post_link", $filter_link_attributes ); - $content = $get_link_function( $format, $link ); - remove_filter( "{$navigation_type}_post_link", $filter_link_attributes ); - return $content; + $content = $get_link_function( $format, $link ); + return sprintf( + '
%2$s
', + $wrapper_attributes, + $content + ); } /** From 92f507e91cebb4e4326899c78950052f06ec5c5f Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Thu, 4 Feb 2021 14:20:55 +0200 Subject: [PATCH 7/7] rename icons and variations --- .../src/post-navigation-link/edit.js | 6 ++---- .../src/post-navigation-link/variations.js | 17 +++++++---------- packages/icons/src/index.js | 4 ++-- .../{post-navigation-link-next.js => next.js} | 4 ++-- ...-navigation-link-previous.js => previous.js} | 4 ++-- 5 files changed, 15 insertions(+), 20 deletions(-) rename packages/icons/src/library/{post-navigation-link-next.js => next.js} (78%) rename packages/icons/src/library/{post-navigation-link-previous.js => previous.js} (76%) diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index 1026eb0fcc3cf..bb0dbae804eae 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -16,15 +16,13 @@ import { } from '@wordpress/block-editor'; import { __ } from '@wordpress/i18n'; -export default function PostNavigationNextEdit( { +export default function PostNavigationLinkEdit( { attributes: { type, label, showTitle, textAlign }, setAttributes, } ) { const isNext = type === 'next'; const placeholder = isNext ? __( 'Next' ) : __( 'Previous' ); - const ariaLabel = isNext - ? __( 'Next post link' ) - : __( 'Previous post link' ); + const ariaLabel = isNext ? __( 'Next post' ) : __( 'Previous post' ); const blockProps = useBlockProps( { className: classnames( { [ `has-text-align-${ textAlign }` ]: textAlign, diff --git a/packages/block-library/src/post-navigation-link/variations.js b/packages/block-library/src/post-navigation-link/variations.js index 4812e30466687..6d3e7f76cd7fa 100644 --- a/packages/block-library/src/post-navigation-link/variations.js +++ b/packages/block-library/src/post-navigation-link/variations.js @@ -2,30 +2,27 @@ * WordPress dependencies */ import { __ } from '@wordpress/i18n'; -import { - postNavigationLinkNext, - postNavigationLinkPrevious, -} from '@wordpress/icons'; +import { next, previous } from '@wordpress/icons'; const variations = [ { isDefault: true, - name: 'post-navigation-link-next', - title: __( 'Next post link' ), + name: 'post-next', + title: __( 'Next post' ), description: __( 'Displays the post link that follows the current post.' ), - icon: postNavigationLinkNext, + icon: next, attributes: { type: 'next' }, scope: [ 'inserter', 'transform' ], }, { - name: 'post-navigation-link-previous', - title: __( 'Previous post link' ), + name: 'post-previous', + title: __( 'Previous post' ), description: __( 'Displays the post link that precedes the current post.' ), - icon: postNavigationLinkPrevious, + icon: previous, attributes: { type: 'previous' }, scope: [ 'inserter', 'transform' ], }, diff --git a/packages/icons/src/index.js b/packages/icons/src/index.js index 25e3c3690b997..2ab18178a4254 100644 --- a/packages/icons/src/index.js +++ b/packages/icons/src/index.js @@ -141,8 +141,8 @@ export { default as postExcerpt } from './library/post-excerpt'; export { default as postFeaturedImage } from './library/post-featured-image'; export { default as postList } from './library/post-list'; export { default as postTitle } from './library/post-title'; -export { default as postNavigationLinkPrevious } from './library/post-navigation-link-previous'; -export { default as postNavigationLinkNext } from './library/post-navigation-link-next'; +export { default as previous } from './library/previous'; +export { default as next } from './library/next'; export { default as preformatted } from './library/preformatted'; export { default as pullLeft } from './library/pull-left'; export { default as pullRight } from './library/pull-right'; diff --git a/packages/icons/src/library/post-navigation-link-next.js b/packages/icons/src/library/next.js similarity index 78% rename from packages/icons/src/library/post-navigation-link-next.js rename to packages/icons/src/library/next.js index 34b0a863131d8..0cefe00162b4e 100644 --- a/packages/icons/src/library/post-navigation-link-next.js +++ b/packages/icons/src/library/next.js @@ -3,10 +3,10 @@ */ import { SVG, Path } from '@wordpress/primitives'; -const postNavigationLinkNext = ( +const next = ( ); -export default postNavigationLinkNext; +export default next; diff --git a/packages/icons/src/library/post-navigation-link-previous.js b/packages/icons/src/library/previous.js similarity index 76% rename from packages/icons/src/library/post-navigation-link-previous.js rename to packages/icons/src/library/previous.js index aaf5229150c12..2495b0f39ad6a 100644 --- a/packages/icons/src/library/post-navigation-link-previous.js +++ b/packages/icons/src/library/previous.js @@ -3,10 +3,10 @@ */ import { SVG, Path } from '@wordpress/primitives'; -const postNavigationLinkPrevious = ( +const previous = ( ); -export default postNavigationLinkPrevious; +export default previous;