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

Commit

Permalink
Merge pull request #10 from TylerBarnes/layouts
Browse files Browse the repository at this point in the history
v1.2.5
  • Loading branch information
TylerBarnes committed Nov 21, 2018
2 parents 4859b36 + 8b48d4e commit 42c0746
Show file tree
Hide file tree
Showing 10 changed files with 253 additions and 25 deletions.
5 changes: 2 additions & 3 deletions src/.babelrc → .babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"presets": [
"@babel/preset-react",
[
"@babel/preset-env",
"babel-preset-gatsby-package",
{
"useBuiltIns": "entry"
"browser": true
}
]
],
Expand Down
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"globals": {
"GATSBY_LAYOUT_COMPONENT_PATH": false
}
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ node_modules/
yarn-error.log
src/package.json
src/package-lock.json
src/yarn-lock.json
src/yarn-lock.json
/*.js
35 changes: 35 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
*.un~
yarn.lock
src
flow-typed
coverage
decls
examples
example
19 changes: 13 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-plugin-transition-link",
"version": "1.2.3",
"version": "1.2.5",
"description": "A link component for page transitions in gatsby.",
"repository": "https://github.com/TylerBarnes/gatsby-plugin-transition-link",
"homepage": "https://gatsby-plugin-transition-link.netlify.com/",
Expand All @@ -16,14 +16,18 @@
"css",
"react animation"
],
"main": "src/index.js",
"main": "index.js",
"author": "Tyler Barnes <tyler@known.design>",
"license": "MIT",
"scripts": {
"develop": "cp -rf package.json src && cd example && gatsby develop",
"copy-npm-files": "cp -rf package.json lib && cp -rf readme.md lib",
"clean-lib": "node_modules/.bin/rimraf ./lib",
"build": "rm src/package.json || true && yarn clean-lib && babel --preset preset-env src --out-dir lib --ignore __tests__ && yarn copy-npm-files"
"copy-files": "mkdir lib || true && cp .eslintrc.json package.json lib",
"build": "yarn copy-files && babel src --out-dir lib --ignore **/__tests__",
"watch": "yarn copy-files && babel -w src --out-dir lib --ignore **/__tests__",
"prepare-files": "cross-env NODE_ENV=production yarn build",
"publish-repo": "yarn copy-files && cd lib && npm publish && cd ../",
"publish-patch": "yarn prepare-files && npx json-bump --patch=1 package.json && yarn publish-repo",
"publish-minor": "yarn prepare-files && npx json-bump --minor=1 package.json && yarn publish-repo",
"publish-major": "yarn prepare-files && npx json-bump --major=1 package.json && yarn publish-repo"
},
"devDependencies": {
"@babel/cli": "^7.1.2",
Expand All @@ -34,7 +38,10 @@
"rimraf": "^2.6.2"
},
"dependencies": {
"babel-preset-gatsby-package": "^0.1.2",
"color-convert": "^1.9.3",
"cross-env": "^5.2.0",
"json-bump": "^0.1.3",
"polyfill-array-includes": "^1.0.0",
"react": "^16.6.0",
"react-transition-group": "^2.5.0",
Expand Down
3 changes: 0 additions & 3 deletions src/.browserslistrc

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/Layout.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const React = require("react");

const preferDefault = m => (m && m.default) || m;
let Layout;
let Layout = false;

if (
typeof GATSBY_LAYOUT_COMPONENT_PATH !== `undefined` &&
Expand All @@ -25,7 +25,7 @@ if (
}

const LayoutComponent = ({ children, ...props }) => {
if (GATSBY_LAYOUT_COMPONENT_PATH) {
if (Layout) {
return <Layout {...props}>{children}</Layout>;
} else {
return children;
Expand Down
8 changes: 3 additions & 5 deletions src/functions/onEnter.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
const onEnter = ({
node,
action,
inTransition,
entryTrigger,
entryProps,
exitProps,
pathname,
e
}) => {
// fix scroll jumping when navigating with browser buttons
if (typeof action !== `undefined` && action !== "PUSH") {
if (inTransition) {
window.scrollTo(0, 0);
} else {
const storageKey = `@@scroll|${pathname}`;
const savedPosition = sessionStorage.getItem(storageKey);
window.scrollTo(...JSON.parse(savedPosition));
} else {
window.scrollTo(0, 0);
}

if (!inTransition) return;
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { TransitionLink } from "./components/TransitionLink";
import TransitionHandler from "./components/TransitionHandler";
import { PublicConsumer as TransitionState } from "./context/createTransitionContext";
import TransitionPortal from "./components/TransitionPortal";
// import AniLink from "./components/AniLink";

export { TransitionHandler, TransitionState, TransitionPortal };
export default TransitionLink;
Loading

0 comments on commit 42c0746

Please sign in to comment.