Skip to content

Commit

Permalink
tests reverting and then adding changes again
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu committed Nov 4, 2022
1 parent 2175d0c commit e4dc96d
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 36 deletions.
117 changes: 81 additions & 36 deletions packages/block-library/src/navigation/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
*/
import classnames from 'classnames';

/**
* WordPress dependencies
*/
/**
* WordPress dependencies
*/
import { useState, useEffect, useRef, Platform } from '@wordpress/element';
import { addQueryArgs } from '@wordpress/url';
import {
__experimentalOffCanvasEditor as OffCanvasEditor,
InspectorControls,
useBlockProps,
__experimentalRecursionProvider as RecursionProvider,
Expand Down Expand Up @@ -37,6 +41,9 @@ import { speak } from '@wordpress/a11y';
import { createBlock } from '@wordpress/blocks';
import { close, Icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
/**
* Internal dependencies
*/
Expand Down Expand Up @@ -82,6 +89,9 @@ function Navigation( {
hasColorSettings = true,
customPlaceholder: CustomPlaceholder = null,
} ) {
const isOffCanvasNavigationEditorEnabled =
window?.__experimentalEnableOffCanvasNavigationEditor === true;

const {
openSubmenusOnClick,
overlayMenu,
Expand Down Expand Up @@ -676,18 +686,27 @@ function Navigation( {
/* translators: %s: The name of a menu. */
actionLabel={ __( "Switch to '%s'" ) }
/>
<Button
variant="link"
disabled={
! hasManagePermissions ||
! hasResolvedNavigationMenus
}
href={ addQueryArgs( 'edit.php', {
post_type: 'wp_navigation',
} ) }
>
{ __( 'Manage menus' ) }
</Button>
{ isOffCanvasNavigationEditorEnabled && (
<OffCanvasEditor
blocks={ innerBlocks }
isExpanded={ true }
selectBlockInCanvas={ false }
/>
) }
{ ! isOffCanvasNavigationEditorEnabled && (
<Button
variant="link"
disabled={
! hasManagePermissions ||
! hasResolvedNavigationMenus
}
href={ addQueryArgs( 'edit.php', {
post_type: 'wp_navigation',
} ) }
>
{ __( 'Manage menus' ) }
</Button>
) }
</PanelBody>
</InspectorControls>
{ stylingInspectorControls }
Expand Down Expand Up @@ -759,18 +778,20 @@ function Navigation( {
/* translators: %s: The name of a menu. */
actionLabel={ __( "Switch to '%s'" ) }
/>
<Button
variant="link"
disabled={
! hasManagePermissions ||
! hasResolvedNavigationMenus
}
href={ addQueryArgs( 'edit.php', {
post_type: 'wp_navigation',
} ) }
>
{ __( 'Manage menus' ) }
</Button>
{ ! isOffCanvasNavigationEditorEnabled && (
<Button
variant="link"
disabled={
! hasManagePermissions ||
! hasResolvedNavigationMenus
}
href={ addQueryArgs( 'edit.php', {
post_type: 'wp_navigation',
} ) }
>
{ __( 'Manage menus' ) }
</Button>
) }
</PanelBody>
</InspectorControls>
<Warning>
Expand Down Expand Up @@ -877,18 +898,27 @@ function Navigation( {
/* translators: %s: The name of a menu. */
actionLabel={ __( "Switch to '%s'" ) }
/>
<Button
variant="link"
disabled={
! hasManagePermissions ||
! hasResolvedNavigationMenus
}
href={ addQueryArgs( 'edit.php', {
post_type: 'wp_navigation',
} ) }
>
{ __( 'Manage menus' ) }
</Button>
{ isOffCanvasNavigationEditorEnabled && (
<OffCanvasEditor
blocks={ innerBlocks }
isExpanded={ true }
selectBlockInCanvas={ false }
/>
) }
{ ! isOffCanvasNavigationEditorEnabled && (
<Button
variant="link"
disabled={
! hasManagePermissions ||
! hasResolvedNavigationMenus
}
href={ addQueryArgs( 'edit.php', {
post_type: 'wp_navigation',
} ) }
>
{ __( 'Manage menus' ) }
</Button>
) }
</PanelBody>
</InspectorControls>
{ stylingInspectorControls }
Expand All @@ -915,6 +945,21 @@ function Navigation( {
} }
/>
) }
{ isOffCanvasNavigationEditorEnabled && (
<Button
variant="link"
className="wp-block-navigation-manage-menus-button"
disabled={
! hasManagePermissions ||
! hasResolvedNavigationMenus
}
href={ addQueryArgs( 'edit.php', {
post_type: 'wp_navigation',
} ) }
>
{ __( 'Manage menus' ) }
</Button>
) }
</InspectorControls>
) }

Expand Down
7 changes: 7 additions & 0 deletions packages/block-library/src/navigation/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,13 @@ body.editor-styles-wrapper
margin-bottom: $grid-unit-20;
}

// increased specificity to override button variant
// for the manage menus button in the advanced area
// of the navigation block
.components-button.is-link.wp-block-navigation-manage-menus-button {
margin-bottom: $grid-unit-20;
}

.wp-block-navigation__overlay-menu-preview {
display: flex;
align-items: center;
Expand Down

0 comments on commit e4dc96d

Please sign in to comment.