-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add animation for block and transaction
- Loading branch information
vien.nguyen2-tiki
committed
Sep 28, 2022
1 parent
a4ea472
commit b7ff487
Showing
15 changed files
with
242 additions
and
205 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useEffect, useState } from 'react' | ||
import { CSSTransition } from 'react-transition-group' | ||
|
||
/** | ||
* @param action true: exec animation | ||
* @param minHeight hold element space | ||
*/ | ||
type RowShowAnimationProps = { | ||
children: React.ReactNode | ||
action: boolean | ||
minHeight?: string | ||
} | ||
export default function RowShowAnimation({ children, action, minHeight = 'unset' }: RowShowAnimationProps) { | ||
const [show, setShow] = useState(false) | ||
useEffect(() => { | ||
if (action) { | ||
setTimeout(() => { | ||
setShow(true) | ||
}, 100) | ||
} | ||
}, []) | ||
return ( | ||
<> | ||
{action ? ( | ||
<div style={{ minHeight: minHeight }}> | ||
<CSSTransition | ||
in={show} | ||
timeout={300} | ||
classNames="alert" | ||
// nodeRef={childrenRef} | ||
unmountOnExit | ||
// onEnter={() => setShowButton(false)} | ||
// onExited={() => setShowButton(true)} | ||
> | ||
{children} | ||
</CSSTransition> | ||
</div> | ||
) : ( | ||
children | ||
)} | ||
</> | ||
) | ||
} |
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,17 @@ | ||
.alert-enter { | ||
opacity: 0; | ||
transform: scale(0.9); | ||
} | ||
.alert-enter-active { | ||
opacity: 1; | ||
transform: translateX(0); | ||
transition: opacity 300ms, transform 300ms; | ||
} | ||
.alert-exit { | ||
opacity: 1; | ||
} | ||
.alert-exit-active { | ||
opacity: 0; | ||
transform: scale(0.9); | ||
transition: opacity 300ms, transform 300ms; | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.