From fc2825256825bb57ddacf465beca1da2c2e08a24 Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Thu, 4 Jun 2020 18:29:59 +0200 Subject: [PATCH] Use Card instead of Panel for the block editor (#22827) * Use Card instead of Panel for BlockEditorPanel * Rename BlockEditorPanel to BlockEditorArea * Move the save and delete buttons to the header * Move the delete button to the footer * Tidy up class names * Remove the second save button (from the footer) --- ...k-editor-panel.js => block-editor-area.js} | 40 +++++++++++-------- .../src/components/menu-editor/index.js | 6 +-- .../src/components/menu-editor/style.scss | 18 ++++++--- 3 files changed, 39 insertions(+), 25 deletions(-) rename packages/edit-navigation/src/components/menu-editor/{block-editor-panel.js => block-editor-area.js} (74%) diff --git a/packages/edit-navigation/src/components/menu-editor/block-editor-panel.js b/packages/edit-navigation/src/components/menu-editor/block-editor-area.js similarity index 74% rename from packages/edit-navigation/src/components/menu-editor/block-editor-panel.js rename to packages/edit-navigation/src/components/menu-editor/block-editor-area.js index 144df87c34df9..9c06ba2c8776e 100644 --- a/packages/edit-navigation/src/components/menu-editor/block-editor-panel.js +++ b/packages/edit-navigation/src/components/menu-editor/block-editor-area.js @@ -14,7 +14,14 @@ import { WritingFlow, } from '@wordpress/block-editor'; import { useEffect } from '@wordpress/element'; -import { Button, Panel, PanelBody, Popover } from '@wordpress/components'; +import { + Button, + Card, + CardHeader, + CardBody, + CardFooter, + Popover, +} from '@wordpress/components'; import { useSelect, useDispatch } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; @@ -23,7 +30,7 @@ import { __ } from '@wordpress/i18n'; */ import DeleteMenuButton from '../delete-menu-button'; -export default function BlockEditorPanel( { +export default function BlockEditorArea( { onDeleteMenu, menuId, saveBlocks, @@ -59,13 +66,17 @@ export default function BlockEditorPanel( { }, [ rootBlockId ] ); return ( - - -
- + + +
+ { __( 'Navigation menu' ) }
+ + +
+ -
- -
- - +
+ + + +
); } diff --git a/packages/edit-navigation/src/components/menu-editor/index.js b/packages/edit-navigation/src/components/menu-editor/index.js index 77416a699009f..ddf5e22732ac7 100644 --- a/packages/edit-navigation/src/components/menu-editor/index.js +++ b/packages/edit-navigation/src/components/menu-editor/index.js @@ -14,7 +14,7 @@ import { useMemo } from '@wordpress/element'; import useMenuItems from './use-menu-items'; import useNavigationBlocks from './use-navigation-blocks'; import MenuEditorShortcuts from './shortcuts'; -import BlockEditorPanel from './block-editor-panel'; +import BlockEditorArea from './block-editor-area'; import NavigationStructureArea from './navigation-structure-area'; export default function MenuEditor( { @@ -60,8 +60,8 @@ export default function MenuEditor( { blocks={ blocks } initialOpen={ isLargeViewport } /> - diff --git a/packages/edit-navigation/src/components/menu-editor/style.scss b/packages/edit-navigation/src/components/menu-editor/style.scss index ae2c8cab11ad5..0e6bfa69a33e1 100644 --- a/packages/edit-navigation/src/components/menu-editor/style.scss +++ b/packages/edit-navigation/src/components/menu-editor/style.scss @@ -62,24 +62,30 @@ font-weight: bold; } -.edit-navigation-menu-editor__block-editor-panel { +.edit-navigation-menu-editor__block-editor-area { @include break-medium { // IE11 requires the column to be explicitly declared. // Only shift this into the second column on desktop. grid-column: 2; } - // Make panels collapsible in IE. The IE analogue of align-items: self-start;. - -ms-grid-row-align: start; + .components-card__footer, + .components-card__header { + display: flex; + align-items: center; + justify-content: space-between; + } + + .edit-navigation-menu-editor__block-editor-area-header-text { + flex-grow: 1; + font-weight: bold; + } } .components-panel__header-actions { - margin-top: $grid-unit-20; - padding-bottom: $grid-unit-20; margin-bottom: $grid-unit-60; width: 100%; text-align: right; - border-bottom: 1px solid $light-gray-300; } .components-panel__footer-actions {