fix fullscreen player transition

This commit is contained in:
jeffvli
2025-12-07 03:08:19 -08:00
parent 9c81487f98
commit 56098c6617
5 changed files with 36 additions and 24 deletions
@@ -566,7 +566,7 @@ const containerVariants: Variants = {
ease: 'easeInOut', ease: 'easeInOut',
}, },
width: '100vw', width: '100vw',
y: -100, y: 0,
}; };
}, },
open: (custom) => { open: (custom) => {
@@ -1,5 +1,7 @@
.container { .container {
position: relative; position: absolute;
top: 0;
left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
@@ -320,24 +320,45 @@ const MobilePlayerContainer = memo(
} }
return ( return (
<div <motion.div
animate="open"
className={styles.container} className={styles.container}
exit="closed"
initial="closed"
style={{ style={{
backgroundColor, backgroundColor,
}} }}
variants={mobileContainerVariants}
> >
<BackgroundImage <BackgroundImage
dynamicBackground={dynamicBackground} dynamicBackground={dynamicBackground}
dynamicIsImage={dynamicIsImage} dynamicIsImage={dynamicIsImage}
/> />
{children} {children}
</div> </motion.div>
); );
}, },
); );
MobilePlayerContainer.displayName = 'MobilePlayerContainer'; MobilePlayerContainer.displayName = 'MobilePlayerContainer';
const mobileContainerVariants: Variants = {
closed: {
y: '100%',
transition: {
duration: 0.5,
ease: 'easeInOut',
},
},
open: {
y: 0,
transition: {
duration: 0.5,
ease: 'easeInOut',
},
},
};
export const MobileFullscreenPlayer = () => { export const MobileFullscreenPlayer = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const setFullScreenPlayerStore = useSetFullScreenPlayerStore(); const setFullScreenPlayerStore = useSetFullScreenPlayerStore();
@@ -39,17 +39,5 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
z-index: 200; z-index: 200;
visibility: hidden; overflow: hidden;
pointer-events: none;
background: var(--theme-colors-background);
opacity: 0;
transition:
opacity 0.3s ease-in-out,
visibility 0.3s ease-in-out;
}
.full-screen-player-visible {
visibility: visible;
pointer-events: auto;
opacity: 1;
} }
@@ -1,3 +1,4 @@
import { AnimatePresence } from 'motion/react';
import clsx from 'clsx'; import clsx from 'clsx';
import { lazy } from 'react'; import { lazy } from 'react';
import { Outlet } from 'react-router'; import { Outlet } from 'react-router';
@@ -66,13 +67,13 @@ export const MobileLayout = ({ shell }: MobileLayoutProps) => {
> >
<MobileSidebar /> <MobileSidebar />
</Drawer> </Drawer>
<div <AnimatePresence initial={false}>
className={clsx(styles.fullScreenPlayerOverlay, { {isFullScreenPlayerExpanded && (
[styles.fullScreenPlayerVisible]: isFullScreenPlayerExpanded, <div className={styles.fullScreenPlayerOverlay}>
})} <MobileFullscreenPlayer />
> </div>
<MobileFullscreenPlayer /> )}
</div> </AnimatePresence>
<CommandPalette modalProps={{ handlers, opened }} /> <CommandPalette modalProps={{ handlers, opened }} />
<ContextMenuController.Root /> <ContextMenuController.Root />
</> </>