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

Site Editor: Try template drill down on shell sidebar (browse mode) #45100

Merged
merged 27 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
957a3f2
Refactor SidebarNavigationRoot to use NavigatorScreen
oandregal Dec 1, 2022
3710f13
Introduce new screen for templates
oandregal Dec 1, 2022
89a21c8
Introduce chevron for SidebarNavigationItem
oandregal Dec 1, 2022
125cb41
Templates screen: add edit button
oandregal Dec 1, 2022
6c2dc03
Signal the template that is selected
oandregal Dec 2, 2022
3a96aa2
Select Templates if any is active
oandregal Dec 2, 2022
c576632
Set template being edited, no matter the theme
oandregal Dec 2, 2022
79718d6
Center align text for "manage all templates"
oandregal Dec 2, 2022
0371b34
Fix VStack/HStack alias
oandregal Dec 2, 2022
5bdebc3
Use same padding bottom in sidebar
oandregal Dec 2, 2022
edbf202
Make template list scrollable
oandregal Dec 2, 2022
3ad7b33
Refactor the sidebar styles and components
youknowriad Dec 5, 2022
d3867ac
Add template parts
youknowriad Dec 5, 2022
d61d0c2
Keep the title sticky
youknowriad Dec 6, 2022
0195866
Add shadow to panel header
jameskoster Dec 6, 2022
de04a76
Apply different styles to hover / current states
jameskoster Dec 6, 2022
4e84696
Remove icons
youknowriad Dec 8, 2022
b9a6fd8
Fix box shadow
youknowriad Dec 8, 2022
586cf8f
update the design of the manage templates link
youknowriad Dec 8, 2022
2e242c3
Fix active template when the home page is static
youknowriad Dec 8, 2022
b9aacce
Add custom scrollbars
youknowriad Dec 8, 2022
3ad1e1d
Fix active element
youknowriad Dec 8, 2022
3e26da3
Space out the see all button
youknowriad Dec 8, 2022
aefdbb2
increase the border width
youknowriad Dec 8, 2022
ad33eca
Fix the jumping
youknowriad Dec 9, 2022
a10399a
Adds comment to CSS
youknowriad Dec 9, 2022
753b99d
Fix e2e test
youknowriad Dec 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions packages/base-styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -550,3 +550,36 @@
}
/* stylelint-enable function-comma-space-after */
}

@mixin custom-scrollbars-on-hover() {
visibility: hidden;

$handle-color: #757575;
$track-color: #1e1e1e;

// WebKit
&::-webkit-scrollbar {
width: 12px;
height: 12px;
}
&::-webkit-scrollbar-track {
background-color: $track-color;
}
&::-webkit-scrollbar-thumb {
background-color: $handle-color;
border-radius: 8px;
border: 3px solid transparent;
background-clip: padding-box;
}

// Firefox 109+ and Chrome 111+
scrollbar-color: $handle-color $track-color; // Syntax, "dark", "light", or "#handle-color #track-color"
scrollbar-width: thin;
scrollbar-gutter: stable;

&:hover,
&:focus,
& > * {
visibility: visible;
}
}
4 changes: 3 additions & 1 deletion packages/edit-site/src/components/layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
.edit-site-layout__sidebar {
grid-area: sidebar;
z-index: 1;
padding-top: $grid-unit-80;
overflow-y: auto;
max-height: calc(100vh - #{$header-height});
@include custom-scrollbars-on-hover;

// This is only necessary for the exit animation
.edit-site-layout.is-full-canvas & {
Expand Down
14 changes: 11 additions & 3 deletions packages/edit-site/src/components/sidebar-navigation-item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import classnames from 'classnames';
import {
__experimentalItem as Item,
__experimentalHStack as HStack,
FlexItem,
FlexBlock,
} from '@wordpress/components';
import { Icon } from '@wordpress/icons';
import { chevronRight, Icon } from '@wordpress/icons';

export default function SidebarNavigationItem( {
className,
icon,
withChevron = false,
children,
...props
} ) {
Expand All @@ -34,7 +35,14 @@ export default function SidebarNavigationItem( {
icon={ icon }
size={ 24 }
/>
<FlexItem>{ children }</FlexItem>
<FlexBlock>{ children }</FlexBlock>
{ withChevron && (
<Icon
style={ { fill: 'currentcolor' } }
icon={ chevronRight }
size={ 24 }
/>
) }
youknowriad marked this conversation as resolved.
Show resolved Hide resolved
</HStack>
) }
{ ! icon && children }
Expand Down
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 packages/edit-site/src/components/sidebar-navigation-root/index.js

This file was deleted.

This file was deleted.

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>
}
/>
);
}