Skip to content

Commit

Permalink
fix: gatsby build error: replaceHistory not an api
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaskarSingh committed Oct 14, 2020
1 parent 0e29198 commit 081439c
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 54 deletions.
3 changes: 0 additions & 3 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ module.exports = {
{
resolve: 'gatsby-plugin-root-import',
},
{
resolve: 'gatsby-plugin-page-transitions',
},
{
resolve: `gatsby-plugin-typography`,
options: {
Expand Down
71 changes: 22 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"gatsby-plugin-metomic": "0.0.2",
"gatsby-plugin-netlify": "^2.2.1",
"gatsby-plugin-offline": "^3.0.32",
"gatsby-plugin-page-transitions": "^1.0.8",
"gatsby-plugin-portal": "^1.0.7",
"gatsby-plugin-prefetch-google-fonts": "^1.4.3",
"gatsby-plugin-react-helmet": "^3.1.21",
Expand All @@ -47,6 +46,7 @@
"react-responsive": "^8.0.3",
"react-spring": "^8.0.27",
"react-tooltip": "^4.2.5",
"react-transition-group": "^4.4.1",
"react-typography": "^0.16.19",
"typography": "^0.16.19",
"typography-theme-alton": "^0.16.19",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/tezos/storyline.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useRef, useState } from 'react';
import PageTransition from 'gatsby-plugin-page-transitions';
import PageTransition from '../../utils/pageTransition';

// CSS
// import '../assets/GameAssets/game.css';
Expand Down
50 changes: 50 additions & 0 deletions src/utils/pageTransition.js
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;

0 comments on commit 081439c

Please sign in to comment.