-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Try restoring the site editor animation #51956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cf0be29
Try restoring the site editor animation
talldan af387c5
fix header animation
SaxonF 9d8f62b
Remove accidental addition of layout prop
talldan e1274aa
tidy up formatting
talldan 2425841
fix animate presence issue
SaxonF 7fa2fdc
Merge branch 'try/restore-site-editor-animation' of https://github.co…
SaxonF 3645aef
Fix animation between sidebar view and distraction free edit view
jeryj 828f2da
Leave sidebar present and maintain canvas to
jeryj b91069e
Fix mobile view for pattern library
jeryj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -224,66 +224,61 @@ export default function Layout() { | |
| <AnimatePresence initial={ false }> | ||
| { isEditorPage && isEditing && ( | ||
| <NavigableRegion | ||
| key="header" | ||
| className="edit-site-layout__header" | ||
| ariaLabel={ __( 'Editor top bar' ) } | ||
| as={ motion.div } | ||
| variants={ { | ||
| isDistractionFree: { opacity: 0 }, | ||
| isDistractionFreeHovering: { opacity: 1 }, | ||
| view: { opacity: 1 }, | ||
| edit: { opacity: 1 }, | ||
| isDistractionFree: { opacity: 0, y: 0 }, | ||
| isDistractionFreeHovering: { | ||
| opacity: 1, | ||
| y: 0, | ||
| }, | ||
| view: { opacity: 1, y: '-100%' }, | ||
| edit: { opacity: 1, y: 0 }, | ||
| } } | ||
| exit={ { | ||
| y: '-100%', | ||
| } } | ||
| initial={ { | ||
| opacity: isDistractionFree ? 1 : 0, | ||
| y: isDistractionFree ? 0 : '-100%', | ||
| } } | ||
| transition={ { | ||
| type: 'tween', | ||
| duration: disableMotion ? 0 : 0.2, | ||
| ease: 'easeOut', | ||
| } } | ||
| > | ||
| { isEditing && <Header /> } | ||
| <Header /> | ||
| </NavigableRegion> | ||
| ) } | ||
| </AnimatePresence> | ||
| </motion.div> | ||
|
|
||
| <div className="edit-site-layout__content"> | ||
| <AnimatePresence initial={ false }> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| { | ||
| <motion.div | ||
| initial={ { | ||
| opacity: 0, | ||
| } } | ||
| animate={ | ||
| showSidebar | ||
| ? { opacity: 1, display: 'block' } | ||
| : { | ||
| opacity: 0, | ||
| transitionEnd: { | ||
| display: 'none', | ||
| }, | ||
| } | ||
| } | ||
| exit={ { | ||
| opacity: 0, | ||
| } } | ||
| transition={ { | ||
| type: 'tween', | ||
| duration: | ||
| // Disable transition in mobile to emulate a full page transition. | ||
| disableMotion || isMobileViewport | ||
| ? 0 | ||
| : ANIMATION_DURATION, | ||
| ease: 'easeOut', | ||
| } } | ||
| className="edit-site-layout__sidebar" | ||
| > | ||
| <NavigableRegion | ||
| ariaLabel={ __( 'Navigation' ) } | ||
| > | ||
| <Sidebar /> | ||
| </NavigableRegion> | ||
| </motion.div> | ||
| } | ||
| </AnimatePresence> | ||
| <motion.div | ||
| // The sidebar is needed for routing on mobile | ||
| // (https://github.com/WordPress/gutenberg/pull/51558/files#r1231763003), | ||
| // so we can't remove the element entirely. Using `inert` will make | ||
| // it inaccessible to screen readers and keyboard navigation. | ||
| inert={ showSidebar ? undefined : 'inert' } | ||
| animate={ { opacity: showSidebar ? 1 : 0 } } | ||
| transition={ { | ||
| type: 'tween', | ||
| duration: | ||
| // Disable transition in mobile to emulate a full page transition. | ||
| disableMotion || isMobileViewport | ||
| ? 0 | ||
| : ANIMATION_DURATION, | ||
| ease: 'easeOut', | ||
| } } | ||
| className="edit-site-layout__sidebar" | ||
| > | ||
| <NavigableRegion ariaLabel={ __( 'Navigation' ) }> | ||
| <Sidebar /> | ||
| </NavigableRegion> | ||
| </motion.div> | ||
|
|
||
| <SavePanel /> | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.