Skip to content

Commit

Permalink
Switch logic, again, so that next points to right and previous points…
Browse files Browse the repository at this point in the history
… to left
  • Loading branch information
carolinan committed Apr 29, 2022
1 parent 62cc7d1 commit af08058
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions packages/block-library/src/post-navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export default function PostNavigationLinkEdit( {

const arrowMap = {
none: '',
arrow: isNext ? '' : '',
chevron: isNext ? '«' : '»',
arrow: isNext ? '' : '',
chevron: isNext ? '»' : '«',
};

const displayArrow = arrowMap[ arrow ];
Expand Down Expand Up @@ -120,9 +120,9 @@ export default function PostNavigationLinkEdit( {
/>
</BlockControls>
<div { ...blockProps }>
{ isNext && displayArrow && (
{ ! isNext && displayArrow && (
<span
className={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }
className={ `wp-block-post-navigation-link__arrow-previous is-arrow-${ arrow }` }
>
{ displayArrow }
</span>
Expand All @@ -145,9 +145,9 @@ export default function PostNavigationLinkEdit( {
{ __( 'An example title' ) }
</a>
) }
{ ! isNext && displayArrow && (
{ isNext && displayArrow && (
<span
className={ `wp-block-post-navigation-link__arrow-previous is-arrow-${ arrow }` }
className={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }
>
{ displayArrow }
</span>
Expand Down
12 changes: 6 additions & 6 deletions packages/block-library/src/post-navigation-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
$arrow_map = array(
'none' => '',
'arrow' => array(
'next' => '',
'previous' => '',
'next' => '',
'previous' => '',
),
'chevron' => array(
'next' => '«',
'previous' => '»',
'next' => '»',
'previous' => '«',
),
);

Expand Down Expand Up @@ -88,9 +88,9 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
$arrow = $arrow_map[ $attributes['arrow'] ][ $navigation_type ];

if ( 'next' === $navigation_type ) {
$format = '<span class="wp-block-post-navigation-link__arrow-next is-arrow-' . $attributes['arrow'] . '">' . $arrow . '</span> %link';
$format = '%link <span class="wp-block-post-navigation-link__arrow-next is-arrow-' . $attributes['arrow'] . '">' . $arrow . '</span>';
} else {
$format = '%link <span class="wp-block-post-navigation-link__arrow-previous is-arrow-' . $attributes['arrow'] . '">' . $arrow . '</span>';
$format = '<span class="wp-block-post-navigation-link__arrow-previous is-arrow-' . $attributes['arrow'] . '">' . $arrow . '</span> %link';
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-navigation-link/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.wp-block-post-navigation-link__arrow-previous {
display: inline-block;
margin-left: 1ch;
margin-right: 1ch;
// chevron(`»`) symbol doesn't need the mirroring by us.
&:not(.is-arrow-chevron) {
// Flip for RTL.
Expand All @@ -12,7 +12,7 @@

.wp-block-post-navigation-link__arrow-next {
display: inline-block;
margin-right: 1ch;
margin-left: 1ch;
// chevron(`»`) symbol doesn't need the mirroring by us.
&:not(.is-arrow-chevron) {
// Flip for RTL.
Expand Down

0 comments on commit af08058

Please sign in to comment.