-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge: Merge branch 'develop' into feat/#433_vitest-setting
- Loading branch information
Showing
24 changed files
with
1,722 additions
and
1,840 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import Lottie from 'lottie-react'; | ||
|
||
import Lottie from '../Lottie'; | ||
import buttonLoadingWhite from '../lotties/buttonLoadingWhite.json'; | ||
|
||
const ButtonLoading = ({ width, height = 28 }: { width: number | undefined; height?: number }) => { | ||
return <Lottie animationData={buttonLoadingWhite} style={{ width: width, height }} />; | ||
return <Lottie animationData={buttonLoadingWhite} style={{ width, height }} />; | ||
}; | ||
|
||
export default ButtonLoading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { type AnimationConfigWithData, type AnimationItem } from 'lottie-web'; | ||
import lottie from 'lottie-web/build/player/lottie_light'; | ||
import { type CSSProperties, useEffect, useRef } from 'react'; | ||
|
||
const Lottie = ({ animationData, style }: { animationData: unknown; style?: CSSProperties }) => { | ||
const animationInstanceRef = useRef<AnimationItem>(); | ||
const animationContainer = useRef<HTMLDivElement>(null); | ||
|
||
const loadAnimation = () => { | ||
// Return if the container ref is null | ||
if (!animationContainer.current) { | ||
return; | ||
} | ||
|
||
// Destroy any previous instance | ||
animationInstanceRef.current?.destroy(); | ||
|
||
// Build the animation configuration | ||
const config: AnimationConfigWithData = { | ||
animationData, | ||
container: animationContainer.current, | ||
}; | ||
|
||
// Save the animation instance | ||
animationInstanceRef.current = lottie.loadAnimation(config); | ||
|
||
// Return a function that will clean up | ||
return () => { | ||
animationInstanceRef.current?.destroy(); | ||
animationInstanceRef.current = undefined; | ||
}; | ||
}; | ||
|
||
useEffect(() => { | ||
const onUnmount = loadAnimation(); | ||
|
||
// Clean up on unmount | ||
return () => onUnmount?.(); | ||
// eslint-disable-next-line | ||
}, [animationData]); | ||
|
||
return <div ref={animationContainer} style={style} />; | ||
}; | ||
|
||
export default Lottie; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.