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

Commit

Permalink
feat(components): ✨ show page read progress
Browse files Browse the repository at this point in the history
  • Loading branch information
filipowm committed Jun 4, 2020
1 parent 9f7c3df commit d0cb66f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
11 changes: 9 additions & 2 deletions config/config-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ const defaults = {
},
scrollTop: true,
showMetadata: true,
propagateNetlifyEnv: true
propagateNetlifyEnv: true,
pageProgress: {
enabled: false,
// includePaths: [],
excludePaths: ["/"],
height: 3,
prependToBody: false,
color: '#A05EB5'
}
},
};

Expand Down Expand Up @@ -214,7 +222,6 @@ const read = () => {
config = _.merge(config, envConfig);
const netlifyConfig = new NetlifyEnvReader(config.features.propagateNetlifyEnv).read();
config = _.merge(config, netlifyConfig)
console.log("meta", config.metadata)
postProcessConfig(config);
return config;
};
Expand Down
10 changes: 10 additions & 0 deletions config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,13 @@ features:
scrollTop: true
showMetadata: true
propagateNetlifyEnv: true
pageProgress:
enabled: true
includePaths:
- "/configuration/advanced/theme"
- regex: "^/syntax"
excludePaths:
- "/"
height: 3
prependToBody: false
color: '#A05EB5'
14 changes: 14 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ const plugins = [
},
},
];

if (config.features.pageProgress && config.features.pageProgress.enabled) {
plugins.push(
{
resolve: "gatsby-plugin-page-progress",
options: {
includePaths: config.features.pageProgress.includePaths,
excludePaths: config.features.pageProgress.excludePaths,
height: config.features.pageProgress.height,
prependToBody: config.features.pageProgress.prependToBody,
color: config.features.pageProgress.color
}
});
}
// check and add algolia
if (
config.features.search &&
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"gatsby-plugin-manifest": "2.4.9",
"gatsby-plugin-mdx": "1.2.13",
"gatsby-plugin-offline": "3.2.7",
"gatsby-plugin-page-progress": "2.0.16",
"gatsby-plugin-react-helmet": "3.3.2",
"gatsby-plugin-react-svg": "3.0.0",
"gatsby-plugin-remove-serviceworker": "1.0.0",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7252,6 +7252,11 @@ gatsby-plugin-page-creator@^2.3.7:
lodash "^4.17.15"
micromatch "^3.1.10"

gatsby-plugin-page-progress@2.0.16:
version "2.0.16"
resolved "https://registry.yarnpkg.com/gatsby-plugin-page-progress/-/gatsby-plugin-page-progress-2.0.16.tgz#cb1b392490d5ee0be4cbe3dce1db2d24c888e430"
integrity sha512-1dDUbsvjNCWdh5pammrJaCkCeE4Tk2YLxeh7N7WWHbsJ+BDqpuCxaXb/dw+ph2uVY595kJQXZTxP5hGAsK8SqA==

gatsby-plugin-react-helmet@3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/gatsby-plugin-react-helmet/-/gatsby-plugin-react-helmet-3.3.2.tgz#5619a1808d9607eb89c19d3f04854f497c6fb890"
Expand Down

0 comments on commit d0cb66f

Please sign in to comment.