-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: gatsby build error: replaceHistory not an api
Issue ref: mongkuen/gatsby-plugin-page-transitions#7
- Loading branch information
1 parent
0e29198
commit 081439c
Showing
5 changed files
with
74 additions
and
54 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,50 @@ | ||
import React from 'react'; | ||
import { | ||
TransitionGroup, | ||
Transition as ReactTransition, | ||
} from 'react-transition-group'; | ||
|
||
const timeout = 800; | ||
const getTransitionStyles = { | ||
entering: { | ||
position: `absolute`, | ||
opacity: 0.1, | ||
}, | ||
entered: { | ||
transition: `opacity ${timeout}ms ease-in-out`, | ||
opacity: 1, | ||
}, | ||
exiting: { | ||
transition: `opacity ${timeout}ms ease-in-out`, | ||
opacity: 0, | ||
}, | ||
}; | ||
|
||
class Transition extends React.PureComponent { | ||
render() { | ||
const { children } = this.props; | ||
|
||
return ( | ||
<TransitionGroup> | ||
<ReactTransition | ||
timeout={{ | ||
enter: timeout, | ||
exit: timeout, | ||
}} | ||
> | ||
{status => ( | ||
<div | ||
style={{ | ||
...getTransitionStyles[status], | ||
}} | ||
> | ||
{children} | ||
</div> | ||
)} | ||
</ReactTransition> | ||
</TransitionGroup> | ||
); | ||
} | ||
} | ||
|
||
export default Transition; |