Skip to content

Commit

Permalink
Change Create Menu UI to use a Card instead of Panel (#23150)
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan authored Jun 16, 2020
1 parent 7f858e0 commit aad6af7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import { some } from 'lodash';
*/
import {
Button,
Panel,
PanelBody,
Card,
CardHeader,
CardBody,
TextControl,
withFocusReturn,
} from '@wordpress/components';
Expand All @@ -23,7 +24,7 @@ const noticeId = 'edit-navigation-create-menu-error';
const menuNameMatches = ( menuName ) => ( menu ) =>
menu.name.toLowerCase() === menuName.toLowerCase();

export function CreateMenuForm( { onCancel, onCreateMenu, menus } ) {
export function CreateMenuArea( { onCancel, onCreateMenu, menus } ) {
const [ menuName, setMenuName ] = useState( '' );
const [ isCreatingMenu, setIsCreatingMenu ] = useState( false );
const menuSaveError = useSelect( ( select ) =>
Expand Down Expand Up @@ -92,8 +93,9 @@ export function CreateMenuForm( { onCancel, onCreateMenu, menus } ) {
);

return (
<Panel className="edit-navigation-menus-editor__create-menu-panel">
<PanelBody title={ __( 'Create navigation menu' ) }>
<Card className="edit-navigation-menus-editor__create-menu-area">
<CardHeader>{ __( 'Create navigation menu' ) }</CardHeader>
<CardBody>
<form onSubmit={ createMenu }>
<TextControl
// Disable reason - autoFocus is legitimate in this usage,
Expand Down Expand Up @@ -125,9 +127,9 @@ export function CreateMenuForm( { onCancel, onCreateMenu, menus } ) {
</Button>
) }
</form>
</PanelBody>
</Panel>
</CardBody>
</Card>
);
}

export default withFocusReturn( CreateMenuForm );
export default withFocusReturn( CreateMenuArea );
4 changes: 2 additions & 2 deletions packages/edit-navigation/src/components/menus-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import CreateMenuPanel from './create-menu-panel';
import CreateMenuArea from './create-menu-area';
import MenuEditor from '../menu-editor';

export default function MenusEditor( { blockEditorSettings } ) {
Expand Down Expand Up @@ -95,7 +95,7 @@ export default function MenusEditor( { blockEditorSettings } ) {
</CardBody>
</Card>
{ isCreateMenuPanelVisible && (
<CreateMenuPanel
<CreateMenuArea
menus={ stateMenus }
onCancel={
// User can only cancel out of menu creation if there
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
margin: 0;
}

.edit-navigation-menus-editor__create-menu-panel {
.edit-navigation-menus-editor__create-menu-area {
margin-bottom: 10px;
}

Expand Down

0 comments on commit aad6af7

Please sign in to comment.