Skip to content

Commit

Permalink
Consistent naming of isLargeViewport
Browse files Browse the repository at this point in the history
isLargeViewport is used as both useViewportMatch( 'medium' ) and useViewportMatch( 'large' ). useViewportMatch( 'medium' ) to mean isLargeViewport seem
s to be the standardized way, so useViewportMatch( 'large' ) should equate to the size above it - isWideViewport.
  • Loading branch information
jeryj committed Nov 10, 2023
1 parent 558ff4a commit 4941d98
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/block-tools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function BlockTools( {
__unstableContentRef,
...props
} ) {
const isLargeViewport = useViewportMatch( 'large' );
const isLargeViewport = useViewportMatch( 'medium' );
const {
clientId,
hasFixedToolbar,
Expand Down
2 changes: 1 addition & 1 deletion packages/customize-widgets/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Header( {
setIsInserterOpened,
isFixedToolbarActive,
} ) {
const isLargeViewport = useViewportMatch( 'large' );
const isLargeViewport = useViewportMatch( 'medium' );
const blockToolbarRef = useRef();
const [ [ hasUndo, hasRedo ], setUndoRedo ] = useState( [
sidebar.hasUndo(),
Expand Down
7 changes: 4 additions & 3 deletions packages/edit-post/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ function Header( {
setEntitiesSavedStatesCallback,
setListViewToggleElement,
} ) {
const isLargeViewport = useViewportMatch( 'large' );
const isWideViewport = useViewportMatch( 'large' );
const isLargeViewport = useViewportMatch( 'medium' );
const blockToolbarRef = useRef();
const {
blockSelectionStart,
Expand Down Expand Up @@ -182,13 +183,13 @@ function Header( {
setEntitiesSavedStatesCallback
}
/>
{ ( isLargeViewport || ! showIconLabels ) && (
{ ( isWideViewport || ! showIconLabels ) && (
<>
<PinnedItems.Slot scope="core/edit-post" />
<MoreMenu showIconLabels={ showIconLabels } />
</>
) }
{ showIconLabels && ! isLargeViewport && (
{ showIconLabels && ! isWideViewport && (
<MoreMenu showIconLabels={ showIconLabels } />
) }
</motion.div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default function HeaderEditMode( { setListViewToggleElement } ) {
};
}, [] );

const isLargeViewport = useViewportMatch( 'large' );
const isLargeViewport = useViewportMatch( 'medium' );
const isTopToolbar = ! isZoomOutMode && hasFixedToolbar && isLargeViewport;
const blockToolbarRef = useRef();

Expand Down
7 changes: 3 additions & 4 deletions packages/edit-widgets/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import { unlock } from '../../lock-unlock';
const { BlockContextualToolbar } = unlock( blockEditorPrivateApis );

function Header( { setListViewToggleElement } ) {
const isMediumViewport = useViewportMatch( 'medium' );
const isLargeViewport = useViewportMatch( 'large' );
const isLargeViewport = useViewportMatch( 'medium' );
const blockToolbarRef = useRef();
const { hasFixedToolbar } = useSelect(
( select ) => ( {
Expand All @@ -38,12 +37,12 @@ function Header( { setListViewToggleElement } ) {
<>
<div className="edit-widgets-header">
<div className="edit-widgets-header__navigable-toolbar-wrapper">
{ isMediumViewport && (
{ isLargeViewport && (
<h1 className="edit-widgets-header__title">
{ __( 'Widgets' ) }
</h1>
) }
{ ! isMediumViewport && (
{ ! isLargeViewport && (
<VisuallyHidden
as="h1"
className="edit-widgets-header__title"
Expand Down

0 comments on commit 4941d98

Please sign in to comment.