@bbki.ng/site 5.8.5 → 5.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { IComPropsRegisteredToSlot } from '#/types/slots';
|
|
4
4
|
|
|
@@ -7,9 +7,28 @@ import { ArrowSvg } from './ArrowSvg';
|
|
|
7
7
|
export const ArrowCom: FC<IComPropsRegisteredToSlot> = ({ data }) => {
|
|
8
8
|
const hasEntry = data as boolean;
|
|
9
9
|
|
|
10
|
+
const [visible, setVisible] = useState(false);
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
// Delay one frame so the initial opacity:0 is painted first
|
|
14
|
+
const raf = requestAnimationFrame(() => setVisible(true));
|
|
15
|
+
return () => cancelAnimationFrame(raf);
|
|
16
|
+
}, []);
|
|
17
|
+
|
|
10
18
|
if (hasEntry) {
|
|
11
19
|
return null;
|
|
12
20
|
}
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
// transition from opacity 0 to 1 when hasEntry changes from true to false
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
style={{
|
|
27
|
+
opacity: visible ? 1 : 0,
|
|
28
|
+
transition: 'opacity 1s ease-in',
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
<ArrowSvg />
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
15
34
|
};
|