Skip to content

Commit

Permalink
Rename to MainDashboardButton
Browse files Browse the repository at this point in the history
  • Loading branch information
vindl committed May 4, 2020
1 parent 75e6fe3 commit 566c91a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 36 deletions.
34 changes: 0 additions & 34 deletions packages/edit-site/src/components/header/close-area/index.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/edit-site/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { PinnedItems } from '@wordpress/interface';
* Internal dependencies
*/
import { useEditorContext } from '../editor';
import __experimentalSiteEditorCloseArea from './close-area';
import MainDashboardButton from './main-dashboard-button';
import MoreMenu from './more-menu';
import TemplateSwitcher from '../template-switcher';
import SaveButton from '../save-button';
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function Header( { openEntitiesSavedStates } ) {

return (
<div className="edit-site-header">
<__experimentalSiteEditorCloseArea.Slot />
<MainDashboardButton.Slot />
<div className="edit-site-header__toolbar">
<Inserter
position="bottom right"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* External dependencies
*/
import { isEmpty } from 'lodash';

/**
* WordPress dependencies
*/
import { createSlotFill } from '@wordpress/components';

/**
* Internal dependencies
*/
import FullscreenModeClose from '../fullscreen-mode-close';

const { Fill: MainDashboardButton, Slot } = createSlotFill(
'SiteEditorMainDashboardButton'
);

MainDashboardButton.Slot = () => (
<Slot>
{ ( fills ) => {
// Return default Close button if no fills are provided, otherwise replace it with available fills.
if ( isEmpty( fills ) ) {
return <FullscreenModeClose />;
}

return <> { fills } </>;
} }
</Slot>
);

export default MainDashboardButton;
2 changes: 2 additions & 0 deletions packages/edit-site/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ export function initialize( id, settings ) {
}
render( <Editor settings={ settings } />, document.getElementById( id ) );
}

export { default as MainDashboardButton } from './components/header/main-dashboard-button';

0 comments on commit 566c91a

Please sign in to comment.