@@ -14,11 +14,35 @@ import {
1414} from '@wordpress/components' ;
1515import { __ } from '@wordpress/i18n' ;
1616import { addQueryArgs } from '@wordpress/url' ;
17- import { wordpress } from '@wordpress/icons' ;
17+ import { wordpress , arrowUpLeft } from '@wordpress/icons' ;
1818import { store as editorStore } from '@wordpress/editor' ;
1919import { store as coreStore } from '@wordpress/core-data' ;
2020import { useReducedMotion } from '@wordpress/compose' ;
2121
22+ const siteIconVariants = {
23+ edit : {
24+ clipPath : 'inset(0% round 0px)' ,
25+ } ,
26+ hover : {
27+ clipPath : 'inset( 22% round 2px )' ,
28+ } ,
29+ tap : {
30+ clipPath : 'inset(0% round 0px)' ,
31+ } ,
32+ } ;
33+
34+ const toggleHomeIconVariants = {
35+ edit : {
36+ opacity : 0 ,
37+ scale : 0.2 ,
38+ } ,
39+ hover : {
40+ opacity : 1 ,
41+ scale : 1 ,
42+ clipPath : 'inset( 22% round 2px )' ,
43+ } ,
44+ } ;
45+
2246function FullscreenModeClose ( { showTooltip, icon, href, initialPost } ) {
2347 const { isRequestingSiteIcon, postType, siteIconUrl } = useSelect (
2448 ( select ) => {
@@ -38,43 +62,50 @@ function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
3862 siteIconUrl : siteData . site_icon_url ,
3963 } ;
4064 } ,
41- [ ]
65+ [ initialPost ?. type ]
4266 ) ;
4367
4468 const disableMotion = useReducedMotion ( ) ;
69+ const transition = {
70+ duration : disableMotion ? 0 : 0.2 ,
71+ } ;
4572
4673 if ( ! postType ) {
4774 return null ;
4875 }
4976
50- let buttonIcon = < Icon size = "36px" icon = { wordpress } /> ;
51-
52- const effect = {
53- expand : {
54- scale : 1.25 ,
55- transition : { type : 'tween' , duration : '0.3' } ,
56- } ,
57- } ;
58-
59- if ( siteIconUrl ) {
60- buttonIcon = (
61- < motion . img
62- variants = { ! disableMotion && effect }
77+ // Create SiteIcon equivalent structure exactly like edit-site
78+ let siteIconContent ;
79+ if ( isRequestingSiteIcon && ! siteIconUrl ) {
80+ siteIconContent = (
81+ < div className = "edit-post-fullscreen-mode-close-site-icon__image" />
82+ ) ;
83+ } else if ( siteIconUrl ) {
84+ siteIconContent = (
85+ < img
86+ className = "edit-post-fullscreen-mode-close-site-icon__image"
6387 alt = { __ ( 'Site Icon' ) }
64- className = "edit-post-fullscreen-mode-close_site-icon"
6588 src = { siteIconUrl }
6689 />
6790 ) ;
68- }
69-
70- if ( isRequestingSiteIcon ) {
71- buttonIcon = null ;
91+ } else {
92+ siteIconContent = (
93+ < Icon
94+ className = "edit-post-fullscreen-mode-close-site-icon__icon"
95+ icon = { wordpress }
96+ size = { 48 }
97+ />
98+ ) ;
7299 }
73100
74101 // Override default icon if custom icon is provided via props.
75- if ( icon ) {
76- buttonIcon = < Icon size = "36px" icon = { icon } /> ;
77- }
102+ const buttonIcon = icon ? (
103+ < Icon size = "36px" icon = { icon } />
104+ ) : (
105+ < div className = "edit-post-fullscreen-mode-close-site-icon" >
106+ { siteIconContent }
107+ </ div >
108+ ) ;
78109
79110 const classes = clsx ( 'edit-post-fullscreen-mode-close' , {
80111 'has-icon' : siteIconUrl ,
@@ -89,16 +120,39 @@ function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
89120 const buttonLabel = postType ?. labels ?. view_items ?? __ ( 'Back' ) ;
90121
91122 return (
92- < motion . div whileHover = "expand" >
123+ < motion . div
124+ className = "edit-post-fullscreen-mode-close__view-mode-toggle"
125+ animate = "edit"
126+ initial = "edit"
127+ whileHover = "hover"
128+ whileTap = "tap"
129+ transition = { transition }
130+ >
93131 < Button
94132 __next40pxDefaultSize
95133 className = { classes }
96134 href = { buttonHref }
97135 label = { buttonLabel }
98136 showTooltip = { showTooltip }
137+ tooltipPosition = "middle right"
99138 >
100- { buttonIcon }
139+ < motion . div variants = { ! disableMotion && siteIconVariants } >
140+ < div className = "edit-post-fullscreen-mode-close__view-mode-toggle-icon" >
141+ { buttonIcon }
142+ </ div >
143+ </ motion . div >
101144 </ Button >
145+ < motion . div
146+ className = { clsx (
147+ 'edit-post-fullscreen-mode-close__back-icon' ,
148+ {
149+ 'has-site-icon' : siteIconUrl ,
150+ }
151+ ) }
152+ variants = { ! disableMotion && toggleHomeIconVariants }
153+ >
154+ < Icon icon = { arrowUpLeft } />
155+ </ motion . div >
102156 </ motion . div >
103157 ) ;
104158}
0 commit comments