-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try template drill down on shell sidebar (browse mode) (#45100)
Co-authored-by: Riad Benguella <[email protected]> Co-authored-by: James Koster <[email protected]>
- Loading branch information
1 parent
04bfaad
commit 299b85e
Showing
17 changed files
with
416 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
packages/edit-site/src/components/sidebar-navigation-item/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
.edit-site-sidebar-navigation-item.components-item { | ||
color: $gray-600; | ||
border-width: $border-width-tab; | ||
|
||
&:hover, | ||
&:focus, | ||
&:focus { | ||
color: $white; | ||
background: $gray-800; | ||
border-width: $border-width-tab; | ||
} | ||
|
||
&[aria-current] { | ||
color: $white; | ||
background: var(--wp-admin-theme-color); | ||
border-width: $border-width-tab; | ||
} | ||
} |
86 changes: 0 additions & 86 deletions
86
packages/edit-site/src/components/sidebar-navigation-root/index.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
packages/edit-site/src/components/sidebar-navigation-root/style.scss
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
packages/edit-site/src/components/sidebar-navigation-screen-main/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { | ||
__experimentalItemGroup as ItemGroup, | ||
__experimentalHStack as HStack, | ||
__experimentalNavigatorButton as NavigatorButton, | ||
Button, | ||
} from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { layout, symbolFilled } from '@wordpress/icons'; | ||
import { useDispatch } from '@wordpress/data'; | ||
import { useViewportMatch } from '@wordpress/compose'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import SidebarNavigationScreen from '../sidebar-navigation-screen'; | ||
import SidebarNavigationItem from '../sidebar-navigation-item'; | ||
import { useLocation } from '../routes'; | ||
import { store as editSiteStore } from '../../store'; | ||
import getIsListPage from '../../utils/get-is-list-page'; | ||
|
||
export default function SidebarNavigationScreenMain() { | ||
const { params } = useLocation(); | ||
const isListPage = getIsListPage( params ); | ||
const isEditorPage = ! isListPage; | ||
const { __unstableSetCanvasMode } = useDispatch( editSiteStore ); | ||
const isMobileViewport = useViewportMatch( 'medium', '<' ); | ||
|
||
return ( | ||
<SidebarNavigationScreen | ||
path="/" | ||
title={ | ||
<HStack style={ { minHeight: 36 } }> | ||
<div>{ __( 'Design' ) }</div> | ||
{ ! isMobileViewport && isEditorPage && ( | ||
<Button | ||
className="edit-site-layout__edit-button" | ||
label={ __( 'Open the editor' ) } | ||
onClick={ () => { | ||
__unstableSetCanvasMode( 'edit' ); | ||
} } | ||
> | ||
{ __( 'Edit' ) } | ||
</Button> | ||
) } | ||
</HStack> | ||
} | ||
content={ | ||
<ItemGroup> | ||
<NavigatorButton | ||
as={ SidebarNavigationItem } | ||
path="/templates" | ||
withChevron | ||
icon={ layout } | ||
> | ||
{ __( 'Templates' ) } | ||
</NavigatorButton> | ||
<NavigatorButton | ||
as={ SidebarNavigationItem } | ||
path="/template-parts" | ||
withChevron | ||
icon={ symbolFilled } | ||
> | ||
{ __( 'Template Parts' ) } | ||
</NavigatorButton> | ||
</ItemGroup> | ||
} | ||
/> | ||
); | ||
} |
Oops, something went wrong.