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

Shayan/76594/fade wrapper typescript migration #23

Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import PropTypes from 'prop-types';
import React from 'react';
import React, { ReactNode } from 'react';
import posed, { PoseGroup } from 'react-pose';

type TFadeWrapperProps = {
children: ReactNode;
is_visible: boolean;
keyname?: string;
type?: 'top' | 'bottom';
className?: string;
};

const FadeInFromTopDiv = posed.div({
enter: {
y: 0,
Expand Down Expand Up @@ -46,7 +53,7 @@ const FadeInOnlyDiv = posed.div({
});

// `flipMove={false}` is necessary to fix react-pose bug: https://github.com/Popmotion/popmotion/issues/805
const FadeWrapper = ({ children, className, is_visible, keyname, type }) => {
const FadeWrapper = ({ children, className, is_visible, keyname, type }: TFadeWrapperProps) => {
if (type === 'top') {
return (
<PoseGroup flipMove={false}>
Expand Down Expand Up @@ -80,12 +87,4 @@ const FadeWrapper = ({ children, className, is_visible, keyname, type }) => {
);
};

FadeWrapper.propTypes = {
children: PropTypes.node,
is_visible: PropTypes.bool,
keyname: PropTypes.string,
type: PropTypes.string,
className: PropTypes.string,
};

export default FadeWrapper;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import FadeWrapper from './fade-wrapper.jsx';
import FadeWrapper from './fade-wrapper';
import './fade-wrapper.scss';

export default FadeWrapper;