This repository has been archived by the owner on Nov 9, 2021. It is now read-only.
-
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 pull request #14 from bharatari/dev
v1.3.0
- Loading branch information
Showing
7 changed files
with
69 additions
and
17 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,32 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
const defaultStyle = { | ||
transition: 'opacity 300ms ease-out', | ||
opacity: 0, | ||
}; | ||
|
||
const transitionStyles = { | ||
entering: { | ||
opacity: 0, | ||
}, | ||
entered: { | ||
opacity: 1, | ||
} | ||
}; | ||
|
||
export default function FadeIn({ startAt, children }) { | ||
const [display, setDisplay] = useState(false); | ||
|
||
useEffect(() => { | ||
setTimeout(() => setDisplay(true), startAt); | ||
}, []); | ||
|
||
return ( | ||
React.cloneElement(children, { | ||
style: { | ||
...defaultStyle, | ||
...transitionStyles[display ? 'entered' : 'entering'], | ||
} | ||
}) | ||
); | ||
} |
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,5 +1,7 @@ | ||
import SlideUp from './SlideUp'; | ||
import FadeIn from './FadeIn'; | ||
|
||
export default { | ||
SlideUp, | ||
FadeIn, | ||
}; |
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
2d855e8
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.
Successfully deployed to following URLs: