-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Zoom Out toggle to editor header when experiment enabled (#65183)
* Add toggle when experiment active * Add new square icon * Use new icon * Remove zoom out desktop 50% from device preview dropdown * Fix console error for stroke-width to strokeWidth --------- Co-authored-by: Jerry Jones <[email protected]> Co-authored-by: getdave <[email protected]> Co-authored-by: jeryj <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: richtabor <[email protected]>
- Loading branch information
1 parent
4c31695
commit 67fe7b0
Showing
5 changed files
with
88 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Button } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
import { useDispatch, useSelect } from '@wordpress/data'; | ||
import { store as blockEditorStore } from '@wordpress/block-editor'; | ||
import { square as zoomOutIcon } from '@wordpress/icons'; | ||
|
||
const ZoomOutToggle = () => { | ||
const { isZoomOutMode } = useSelect( ( select ) => ( { | ||
isZoomOutMode: | ||
select( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out', | ||
} ) ); | ||
|
||
const { __unstableSetEditorMode } = useDispatch( blockEditorStore ); | ||
|
||
const handleZoomOut = () => { | ||
__unstableSetEditorMode( isZoomOutMode ? 'edit' : 'zoom-out' ); | ||
}; | ||
|
||
return ( | ||
<Button | ||
onClick={ handleZoomOut } | ||
icon={ zoomOutIcon } | ||
label={ __( 'Toggle Zoom Out' ) } | ||
isPressed={ isZoomOutMode } | ||
size="compact" | ||
/> | ||
); | ||
}; | ||
|
||
export default ZoomOutToggle; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { SVG, Path } from '@wordpress/primitives'; | ||
|
||
const square = ( | ||
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> | ||
<Path | ||
fill="none" | ||
d="M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25" | ||
stroke="currentColor" | ||
strokeWidth="1.5" | ||
strokeLinecap="square" | ||
/> | ||
</SVG> | ||
); | ||
|
||
export default square; |
67fe7b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 67fe7b0.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10832714609
📝 Reported issues:
/test/e2e/specs/site-editor/template-part.spec.js