Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 42c0746

Browse files
authored
Merge pull request #10 from TylerBarnes/layouts
v1.2.5
2 parents 4859b36 + 8b48d4e commit 42c0746

File tree

10 files changed

+253
-25
lines changed

10 files changed

+253
-25
lines changed

src/.babelrc renamed to .babelrc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
22
"presets": [
3-
"@babel/preset-react",
43
[
5-
"@babel/preset-env",
4+
"babel-preset-gatsby-package",
65
{
7-
"useBuiltIns": "entry"
6+
"browser": true
87
}
98
]
109
],

.eslintrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"globals": {
3+
"GATSBY_LAYOUT_COMPONENT_PATH": false
4+
}
5+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ node_modules/
44
yarn-error.log
55
src/package.json
66
src/package-lock.json
7-
src/yarn-lock.json
7+
src/yarn-lock.json
8+
/*.js

.npmignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# node-waf configuration
20+
.lock-wscript
21+
22+
# Compiled binary addons (http://nodejs.org/api/addons.html)
23+
build/Release
24+
25+
# Dependency directory
26+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27+
node_modules
28+
*.un~
29+
yarn.lock
30+
src
31+
flow-typed
32+
coverage
33+
decls
34+
examples
35+
example

package.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gatsby-plugin-transition-link",
3-
"version": "1.2.3",
3+
"version": "1.2.5",
44
"description": "A link component for page transitions in gatsby.",
55
"repository": "https://github.com/TylerBarnes/gatsby-plugin-transition-link",
66
"homepage": "https://gatsby-plugin-transition-link.netlify.com/",
@@ -16,14 +16,18 @@
1616
"css",
1717
"react animation"
1818
],
19-
"main": "src/index.js",
19+
"main": "index.js",
2020
"author": "Tyler Barnes <[email protected]>",
2121
"license": "MIT",
2222
"scripts": {
23-
"develop": "cp -rf package.json src && cd example && gatsby develop",
24-
"copy-npm-files": "cp -rf package.json lib && cp -rf readme.md lib",
25-
"clean-lib": "node_modules/.bin/rimraf ./lib",
26-
"build": "rm src/package.json || true && yarn clean-lib && babel --preset preset-env src --out-dir lib --ignore __tests__ && yarn copy-npm-files"
23+
"copy-files": "mkdir lib || true && cp .eslintrc.json package.json lib",
24+
"build": "yarn copy-files && babel src --out-dir lib --ignore **/__tests__",
25+
"watch": "yarn copy-files && babel -w src --out-dir lib --ignore **/__tests__",
26+
"prepare-files": "cross-env NODE_ENV=production yarn build",
27+
"publish-repo": "yarn copy-files && cd lib && npm publish && cd ../",
28+
"publish-patch": "yarn prepare-files && npx json-bump --patch=1 package.json && yarn publish-repo",
29+
"publish-minor": "yarn prepare-files && npx json-bump --minor=1 package.json && yarn publish-repo",
30+
"publish-major": "yarn prepare-files && npx json-bump --major=1 package.json && yarn publish-repo"
2731
},
2832
"devDependencies": {
2933
"@babel/cli": "^7.1.2",
@@ -34,7 +38,10 @@
3438
"rimraf": "^2.6.2"
3539
},
3640
"dependencies": {
41+
"babel-preset-gatsby-package": "^0.1.2",
3742
"color-convert": "^1.9.3",
43+
"cross-env": "^5.2.0",
44+
"json-bump": "^0.1.3",
3845
"polyfill-array-includes": "^1.0.0",
3946
"react": "^16.6.0",
4047
"react-transition-group": "^2.5.0",

src/.browserslistrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/components/Layout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const React = require("react");
22

33
const preferDefault = m => (m && m.default) || m;
4-
let Layout;
4+
let Layout = false;
55

66
if (
77
typeof GATSBY_LAYOUT_COMPONENT_PATH !== `undefined` &&
@@ -25,7 +25,7 @@ if (
2525
}
2626

2727
const LayoutComponent = ({ children, ...props }) => {
28-
if (GATSBY_LAYOUT_COMPONENT_PATH) {
28+
if (Layout) {
2929
return <Layout {...props}>{children}</Layout>;
3030
} else {
3131
return children;

src/functions/onEnter.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
const onEnter = ({
22
node,
3-
action,
43
inTransition,
54
entryTrigger,
65
entryProps,
76
exitProps,
87
pathname,
98
e
109
}) => {
11-
// fix scroll jumping when navigating with browser buttons
12-
if (typeof action !== `undefined` && action !== "PUSH") {
10+
if (inTransition) {
11+
window.scrollTo(0, 0);
12+
} else {
1313
const storageKey = `@@scroll|${pathname}`;
1414
const savedPosition = sessionStorage.getItem(storageKey);
1515
window.scrollTo(...JSON.parse(savedPosition));
16-
} else {
17-
window.scrollTo(0, 0);
1816
}
1917

2018
if (!inTransition) return;

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { TransitionLink } from "./components/TransitionLink";
22
import TransitionHandler from "./components/TransitionHandler";
33
import { PublicConsumer as TransitionState } from "./context/createTransitionContext";
44
import TransitionPortal from "./components/TransitionPortal";
5-
// import AniLink from "./components/AniLink";
65

76
export { TransitionHandler, TransitionState, TransitionPortal };
87
export default TransitionLink;

0 commit comments

Comments
 (0)