CoastalCommitsPastes/client/components/fade-in/index.tsx

31 lines
515 B
TypeScript
Raw Normal View History

// https://www.joshwcomeau.com/snippets/react-components/fade-in/
2022-04-09 20:48:19 -04:00
import styles from "./fade.module.css"
const FadeIn = ({
2022-04-09 20:48:19 -04:00
duration = 300,
delay = 0,
children,
...delegated
}: {
2022-04-09 20:48:19 -04:00
duration?: number
delay?: number
children: React.ReactNode
[key: string]: any
}) => {
2022-04-09 20:48:19 -04:00
return (
<div
{...delegated}
className={styles.fadeIn}
style={{
...(delegated.style || {}),
animationDuration: duration + "ms",
animationDelay: delay + "ms"
}}
>
{children}
</div>
)
}
export default FadeIn