Skip to content
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

Revert "fix: fade animation props" #5026

Merged
merged 1 commit into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 5 additions & 25 deletions src/components/composites/Transitions/Fade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,16 @@ import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps';
import { usePropsResolution } from '../../../hooks/';

const Fade = ({ children, ...props }: IFadeProps, ref?: any) => {
const {
in: animationState,
entryDuration,
exitDuration,
delay,
...resolvedProps
} = usePropsResolution('Fade', props);

// Need to have similar API for all animations

// Temporary fix
const animationStyle = {
style: {
initial: { opacity: 0 },
animate: { opacity: 1, transition: { duration: entryDuration, delay } },
exit: { opacity: 0, transition: { duration: exitDuration, delay } },
},
};

const { in: animationState, ...resolvedProps } = usePropsResolution(
'Fade',
props
);
//TODO: refactor for responsive prop
if (useHasResponsiveProps(props)) {
return null;
}
return (
<PresenceTransition
visible={animationState}
{...animationStyle.style}
{...resolvedProps}
ref={ref}
>
<PresenceTransition visible={animationState} {...resolvedProps} ref={ref}>
{children}
</PresenceTransition>
);
Expand Down
11 changes: 8 additions & 3 deletions src/theme/components/transitions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
//Fade
// const fadeDefaultProps = {
// entryDuration: 500,
// exitDuration: 500,
// };

export const fadeBaseStyle = {
entryDuration: 500,
exitDuration: 500,
delay: 0,
initial: { opacity: 0 },
animate: { opacity: 1, transition: { duration: 500 } },
exit: { opacity: 0, transition: { duration: 500 } },
};
export const Fade = {
baseStyle: fadeBaseStyle,
Expand Down