-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Namadillo: timeline animations (#1454)
* feat: adding animejs * feat: first animation version * feat: first try on animation * feat: starting to remove framer-motion * feat: fixing error state * refactor: removing unused code * fix: moving animejs deps to the right package.json
- Loading branch information
1 parent
d7a75e3
commit 50f78eb
Showing
7 changed files
with
209 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { RefObject, useEffect } from "react"; | ||
|
||
type QueryFnOutput = ReturnType<typeof document.querySelectorAll>; | ||
type CallbackFn = (query: string) => QueryFnOutput; | ||
type CallbackProps = (callback: CallbackFn, container: HTMLElement) => void; | ||
|
||
export const useScope = ( | ||
callback: CallbackProps, | ||
scope: RefObject<HTMLElement>, | ||
dependencies: unknown[] = [] | ||
): void => { | ||
useEffect(() => { | ||
const queryFn = (query: string): QueryFnOutput => { | ||
if (!scope.current) | ||
throw "You must pass a valid scope for useAnimation hook"; | ||
return scope.current.querySelectorAll(query); | ||
}; | ||
|
||
if (!scope.current) return; | ||
callback(queryFn, scope.current); | ||
}, [...dependencies]); | ||
}; |
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
50f78eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://namada-interface-dev.netlify.app as production
🚀 Deployed on https://6773107c5623f535cce9db8f--namada-interface-dev.netlify.app