Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Create Menu UI to use a Card instead of Panel #23150

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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