({
direction = 'up',
delay = 0,
once = true,
children,
}: {
direction?: FadeDirection;
delay?: FadeDelay;
once?: boolean;
children: JSX.Element;
})
| 40 | }; |
| 41 | |
| 42 | const FadeIn = ({ |
| 43 | direction = 'up', |
| 44 | delay = 0, |
| 45 | once = true, |
| 46 | children, |
| 47 | }: { |
| 48 | direction?: FadeDirection; |
| 49 | delay?: FadeDelay; |
| 50 | once?: boolean; |
| 51 | children: JSX.Element; |
| 52 | }) => { |
| 53 | const [hidden, visible] = getClassNamesByDirection(direction); |
| 54 | const delayClassName = getClassNameByDelay(delay); |
| 55 | |
| 56 | return ( |
| 57 | <InView triggerOnce={once}> |
| 58 | {({ inView, ref, entry }) => { |
| 59 | return ( |
| 60 | <div |
| 61 | ref={ref} |
| 62 | className={classNames(delayClassName, styles.transform, { |
| 63 | [styles.opacity100]: inView, |
| 64 | [visible]: inView, |
| 65 | [styles.opacity0]: !inView, |
| 66 | [hidden]: !inView, |
| 67 | })} |
| 68 | > |
| 69 | {children} |
| 70 | </div> |
| 71 | ); |
| 72 | }} |
| 73 | </InView> |
| 74 | ); |
| 75 | }; |
| 76 | |
| 77 | export default FadeIn; |
nothing calls this directly
no test coverage detected