MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / FadeIn

Function FadeIn

apps/web/ui/FadeIn/index.tsx:42–75  ·  view source on GitHub ↗
({
  direction = 'up',
  delay = 0,
  once = true,
  children,
}: {
  direction?: FadeDirection;
  delay?: FadeDelay;
  once?: boolean;
  children: JSX.Element;
})

Source from the content-addressed store, hash-verified

40};
41
42const 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
77export default FadeIn;

Callers

nothing calls this directly

Calls 2

getClassNamesByDirectionFunction · 0.85
getClassNameByDelayFunction · 0.85

Tested by

no test coverage detected