@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
@@ -1,5 +1,11 @@
1
1
  # @bbki.ng/site
2
2
 
3
+ ## 5.8.6
4
+
5
+ ### Patch Changes
6
+
7
+ - b578955: add transition to arrow
8
+
3
9
  ## 5.8.5
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "5.8.5",
3
+ "version": "5.8.6",
4
4
  "description": "code behind bbki.ng",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -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
- return <ArrowSvg />;
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
  };