Skip to content

Commit

Permalink
no styles drill down; disable style books click;
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Sep 30, 2024
1 parent 45d4e97 commit 3525c68
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 37 deletions.
1 change: 1 addition & 0 deletions packages/edit-site/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export default function Layout( { route } ) {
gradientValue ??
backgroundColor,
} }
hasResize={ widths?.hasResize }
>
{ areas.preview }
</ResizableFrame>
Expand Down
3 changes: 2 additions & 1 deletion packages/edit-site/src/components/layout/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default function useLayoutAreas() {
// Styles
if ( path && path.startsWith( '/wp_global_styles' ) ) {
return {
key: 'styles',
key: 'default',
areas: {
sidebar: (
<SidebarNavigationScreenGlobalStyles backPath={ {} } />
Expand All @@ -167,6 +167,7 @@ export default function useLayoutAreas() {
},
widths: {
content: 380,
hasResize: false,
},
};
}
Expand Down
5 changes: 3 additions & 2 deletions packages/edit-site/src/components/resizable-frame/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function ResizableFrame( {
isOversized,
setIsOversized,
isReady,
hasResize = true,
children,
/** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */
defaultSize,
Expand Down Expand Up @@ -254,8 +255,8 @@ function ResizableFrame( {
bottom: false,
// Resizing will be disabled until the editor content is loaded.
...( isRTL()
? { right: isReady, left: false }
: { left: isReady, right: false } ),
? { right: isReady && hasResize, left: false }
: { left: isReady && hasResize, right: false } ),
topRight: false,
bottomRight: false,
bottomLeft: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-d
import { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main';
import SidebarButton from '../sidebar-button';

const { useHistory } = unlock( routerPrivateApis );
const { useLocation } = unlock( routerPrivateApis );

export function SidebarNavigationItemGlobalStyles( props ) {
const { openGeneralSidebar } = useDispatch( editSiteStore );
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );

const { params } = useLocation();
const hasGlobalStyleVariations = useSelect(
( select ) =>
!! select(
Expand All @@ -42,24 +40,16 @@ export function SidebarNavigationItemGlobalStyles( props ) {
{ ...props }
params={ { path: '/wp_global_styles' } }
uid="global-styles-navigation-item"
aria-current={
params.path && params.path.startsWith( '/wp_global_styles' )
}
/>
);
}
return (
<SidebarNavigationItem
{ ...props }
onClick={ () => {
// Switch to edit mode.
setCanvasMode( 'edit' );
// Open global styles sidebar.
openGeneralSidebar( 'edit-site/global-styles' );
} }
/>
);
return <SidebarNavigationItem { ...props } />;
}

export default function SidebarNavigationScreenGlobalStyles( { backPath } ) {
const history = useHistory();
export default function SidebarNavigationScreenGlobalStyles() {
const { revisions, isLoading: isLoadingRevisions } =
useGlobalStylesRevisions();
const { openGeneralSidebar } = useDispatch( editSiteStore );
Expand Down Expand Up @@ -106,15 +96,14 @@ export default function SidebarNavigationScreenGlobalStyles( { backPath } ) {
const modifiedDateTime = revisions?.[ 0 ]?.modified;
const shouldShowGlobalStylesFooter =
hasRevisions && ! isLoadingRevisions && modifiedDateTime;

return (
<>
<SidebarNavigationScreen
title={ __( 'Styles' ) }
title={ __( 'Design' ) }
isRoot
description={ __(
'Change the look and feel of your web site.'
'Customize the appearance of your website using the block editor.'
) }
backPath={ backPath }
content={
<MainSidebarNavigationContent activeItem="styles-navigation-item" />
}
Expand Down Expand Up @@ -152,13 +141,7 @@ export default function SidebarNavigationScreenGlobalStyles( { backPath } ) {
isSelected={ () => false }
showCloseButton={ false }
showTabs={ false }
onSelect={ ( blockName ) => {
history.push( {
path: `/wp_global_styles/blocks/${ encodeURIComponent(
blockName
) }`,
} );
} }
onClick={ () => {} }
/>
) }
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ import {
PATTERN_TYPES,
} from '../../utils/constants';

export function MainSidebarNavigationContent( { activeItem } ) {
export function MainSidebarNavigationContent() {
return (
<ItemGroup>
<SidebarNavigationItem
uid="navigation-navigation-item"
params={ { postType: NAVIGATION_POST_TYPE } }
withChevron
icon={ navigation }
aria-current={ activeItem === 'navigation-navigation-item' }
>
{ __( 'Navigation' ) }
</SidebarNavigationItem>
Expand All @@ -38,7 +37,6 @@ export function MainSidebarNavigationContent( { activeItem } ) {
className="is-selected"
withChevron
icon={ styles }
aria-current={ activeItem === 'styles-navigation-item' }
>
{ __( 'Styles' ) }
</SidebarNavigationItemGlobalStyles>
Expand All @@ -47,7 +45,6 @@ export function MainSidebarNavigationContent( { activeItem } ) {
params={ { postType: 'page' } }
withChevron
icon={ page }
aria-current={ activeItem === 'page-navigation-item' }
>
{ __( 'Pages' ) }
</SidebarNavigationItem>
Expand All @@ -56,7 +53,6 @@ export function MainSidebarNavigationContent( { activeItem } ) {
params={ { postType: TEMPLATE_POST_TYPE } }
withChevron
icon={ layout }
aria-current={ activeItem === 'template-navigation-item' }
>
{ __( 'Templates' ) }
</SidebarNavigationItem>
Expand All @@ -65,7 +61,6 @@ export function MainSidebarNavigationContent( { activeItem } ) {
params={ { postType: PATTERN_TYPES.user } }
withChevron
icon={ symbol }
aria-current={ activeItem === 'patterns-navigation-item' }
>
{ __( 'Patterns' ) }
</SidebarNavigationItem>
Expand Down

0 comments on commit 3525c68

Please sign in to comment.