Move fadein directly to component

This commit is contained in:
jeffvli
2022-11-05 12:00:46 -07:00
parent 385ec5f856
commit 07123615ca
4 changed files with 23 additions and 7 deletions
@@ -82,12 +82,14 @@ interface ImageProps {
} }
const Image = styled.img<ImageProps>` const Image = styled.img<ImageProps>`
${fadeIn};
width: ${({ height }) => `${height}px`}; width: ${({ height }) => `${height}px`};
height: ${({ height }) => `${height}px`}; height: ${({ height }) => `${height}px`};
object-fit: cover; object-fit: cover;
border: 0; border: 0;
border-radius: 2px; border-radius: 2px;
${fadeIn}
animation: fadein 0.3s ease-in-out;
`; `;
const ControlsContainer = styled.div` const ControlsContainer = styled.div`
@@ -32,11 +32,13 @@ const MetadataStack = styled(motion.div)`
`; `;
const Image = styled(motion(Link))` const Image = styled(motion(Link))`
${fadeIn};
width: 70px; width: 70px;
height: 70px; height: 70px;
filter: drop-shadow(0 0 5px rgb(0, 0, 0, 100%)); filter: drop-shadow(0 0 5px rgb(0, 0, 0, 100%));
${fadeIn};
animation: fadein 0.2s ease-in-out;
button { button {
display: none; display: none;
} }
@@ -91,7 +93,7 @@ export const LeftControls = () => {
transition={{ duration: 0.3, ease: 'easeInOut' }} transition={{ duration: 0.3, ease: 'easeInOut' }}
> >
{song?.imageUrl ? ( {song?.imageUrl ? (
<PlayerbarImage src={song?.imageUrl} /> <PlayerbarImage loading="eager" src={song?.imageUrl} />
) : ( ) : (
<> <>
<Center <Center
@@ -30,10 +30,12 @@ const SidebarContainer = styled.div`
`; `;
const ImageContainer = styled(motion(Link))<{ height: string }>` const ImageContainer = styled(motion(Link))<{ height: string }>`
${fadeIn};
position: relative; position: relative;
height: ${(props) => props.height}; height: ${(props) => props.height};
${fadeIn};
animation: fadein 0.2s ease-in-out;
button { button {
display: none; display: none;
} }
@@ -188,7 +190,7 @@ export const Sidebar = () => {
transition={{ duration: 0.3, ease: 'easeInOut' }} transition={{ duration: 0.3, ease: 'easeInOut' }}
> >
{imageUrl ? ( {imageUrl ? (
<SidebarImage src={imageUrl} /> <SidebarImage loading="eager" src={imageUrl} />
) : ( ) : (
<Center <Center
sx={{ background: 'var(--placeholder-bg)', height: '100%' }} sx={{ background: 'var(--placeholder-bg)', height: '100%' }}
+12 -2
View File
@@ -30,8 +30,6 @@ export const coverBackground = css`
`; `;
export const fadeIn = css` export const fadeIn = css`
animation: fadein 0.3s;
@keyframes fadein { @keyframes fadein {
from { from {
opacity: 0; opacity: 0;
@@ -42,3 +40,15 @@ export const fadeIn = css`
} }
} }
`; `;
export const rotating = css`
@keyframes rotating {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
`;