@@ -7,8 +7,16 @@ import classnames from 'classnames';
77 * WordPress dependencies
88 */
99import { useDispatch , useSelect } from '@wordpress/data' ;
10- import { Notice } from '@wordpress/components' ;
11- import { useInstanceId , useViewportMatch } from '@wordpress/compose' ;
10+ import {
11+ Notice ,
12+ __unstableAnimatePresence as AnimatePresence ,
13+ __unstableMotion as motion ,
14+ } from '@wordpress/components' ;
15+ import {
16+ useInstanceId ,
17+ useViewportMatch ,
18+ useReducedMotion ,
19+ } from '@wordpress/compose' ;
1220import { store as preferencesStore } from '@wordpress/preferences' ;
1321import {
1422 BlockBreadcrumb ,
@@ -40,6 +48,7 @@ import {
4048 SidebarInspectorFill ,
4149} from '../sidebar-edit-mode' ;
4250import CodeEditor from '../code-editor' ;
51+ import Header from '../header-edit-mode' ;
4352import KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode' ;
4453import WelcomeGuide from '../welcome-guide' ;
4554import StartTemplateOptions from '../start-template-options' ;
@@ -70,8 +79,12 @@ const interfaceLabels = {
7079 actions : __ ( 'Editor publish' ) ,
7180 /* translators: accessibility text for the editor footer landmark region. */
7281 footer : __ ( 'Editor footer' ) ,
82+ /* translators: accessibility text for the editor header landmark region. */
83+ header : __ ( 'Editor top bar' ) ,
7384} ;
7485
86+ const ANIMATION_DURATION = 0.25 ;
87+
7588export default function Editor ( { isLoading, onClick } ) {
7689 const {
7790 record : editedPost ,
@@ -82,6 +95,7 @@ export default function Editor( { isLoading, onClick } ) {
8295 const { type : editedPostType } = editedPost ;
8396
8497 const isLargeViewport = useViewportMatch ( 'medium' ) ;
98+ const disableMotion = useReducedMotion ( ) ;
8599
86100 const {
87101 context,
@@ -213,6 +227,35 @@ export default function Editor( { isLoading, onClick } ) {
213227 'show-icon-labels' : showIconLabels ,
214228 }
215229 ) }
230+ header = {
231+ < AnimatePresence initial = { false } >
232+ { canvasMode === 'edit' && (
233+ < motion . div
234+ initial = { {
235+ marginTop : - 60 ,
236+ } }
237+ animate = { {
238+ marginTop : 0 ,
239+ } }
240+ exit = { {
241+ marginTop : - 60 ,
242+ } }
243+ transition = { {
244+ type : 'tween' ,
245+ duration :
246+ // Disable transition in mobile to emulate a full page transition.
247+ disableMotion ||
248+ ! isLargeViewport
249+ ? 0
250+ : ANIMATION_DURATION ,
251+ ease : [ 0.6 , 0 , 0.4 , 1 ] ,
252+ } }
253+ >
254+ < Header />
255+ </ motion . div >
256+ ) }
257+ </ AnimatePresence >
258+ }
216259 notices = { < EditorSnackbars /> }
217260 content = {
218261 < >
0 commit comments