l-min-components 1.0.500 → 1.0.503

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.500",
3
+ "version": "1.0.503",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -21,6 +21,7 @@
21
21
  "emoji-picker-react": "^4.4.10",
22
22
  "i": "^0.3.7",
23
23
  "js-cookie": "^3.0.5",
24
+ "lottie-web": "^5.12.2",
24
25
  "moment": "^2.29.4",
25
26
  "npm": "^10.2.5",
26
27
  "prop-types": "^15.8.1",
@@ -3,9 +3,11 @@ import styled, { css } from 'styled-components';
3
3
  import loaderGif from './assets/first.gif';
4
4
  import Lottie from 'react-lottie';
5
5
  import defaultLoaderAnimation from './loader_3.json';
6
+ import Loader from './loader';
6
7
 
7
8
  /**
8
9
  * @param {{
10
+ * loaderAsset: object,
9
11
  * isSectionLoader: boolean,
10
12
  * hasBackground: boolean,
11
13
  * }} props - properties of the dropdown component
@@ -55,21 +57,12 @@ const LoaderWrapper = styled.div`
55
57
  }
56
58
  `;
57
59
 
58
- const FullPageLoader = ({ isSectionLoader = false, hasBackground = false }) => {
59
-
60
- const defaultOptions = {
61
- loop: true,
62
- autoplay: true,
63
- animationData: defaultLoaderAnimation,
64
- rendererSettings: {
65
- preserveAspectRatio: 'xMidYMid slice'
66
- }
67
- };
60
+ const FullPageLoader = ({ isSectionLoader = false, hasBackground = false, loaderAsset, }) => {
68
61
 
69
62
  return (
70
63
  <Backdrop isSectionLoader={isSectionLoader} hasBackground={hasBackground}>
71
64
  <LoaderWrapper isSectionLoader={isSectionLoader}>
72
- <Lottie options={defaultOptions} height={300} width={300} />
65
+ <Loader loaderAsset={loaderAsset} />
73
66
  </LoaderWrapper>
74
67
  </Backdrop>
75
68
  );
@@ -0,0 +1,35 @@
1
+
2
+ import React, { useEffect, useRef } from 'react';
3
+ import lottie from 'lottie-web';
4
+ import styled from 'styled-components';
5
+ import defaultLoaderAnimation from './loader_3.json';
6
+
7
+ const LoaderWrapper = styled.div`
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ width: 400px;
12
+ height: 400px;
13
+ `;
14
+
15
+ const PageLoader = ({ loaderAsset = defaultLoaderAnimation }) => {
16
+ const animationContainer = useRef(null);
17
+
18
+ useEffect(() => {
19
+ const anim = lottie.loadAnimation({
20
+ container: animationContainer.current,
21
+ renderer: 'svg',
22
+ loop: true,
23
+ autoplay: true,
24
+ animationData: loaderAsset
25
+ });
26
+
27
+ return () => anim.destroy(); // Cleanup animation on unmount
28
+ }, [loaderAsset]);
29
+
30
+ return (
31
+ <LoaderWrapper ref={animationContainer} />
32
+ );
33
+ };
34
+
35
+ export default PageLoader;