Created
November 14, 2017 00:30
-
-
Save jacobtoye/745c2fc2bccd532a10e15c889ea5bb40 to your computer and use it in GitHub Desktop.
This file contains 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
import * as React from 'react'; | |
import './styles.css'; | |
export interface AnimationProps { | |
isAnimated?: boolean; | |
} | |
export const withAnimation = <T extends {}>(WrappedComponent: React.ComponentClass<T>) => { | |
return class extends React.Component<T & AnimationProps> { | |
render() { | |
// TODO: we should use an enum to determine the animation | |
const className = this.props.isAnimated ? 'fade-in-out' : ''; | |
return ( | |
<div className={className}> | |
<WrappedComponent {...this.props} /> | |
</div> | |
); | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment