Skip to content

Commit

Permalink
Merge pull request #30 from alisonjoseph/config-updates
Browse files Browse the repository at this point in the history
feat: enable search add favicon
  • Loading branch information
alisonjoseph authored Aug 7, 2019
2 parents 4a1c74a + 3cd9206 commit 097dac0
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
3 changes: 3 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ module.exports = {
resolve: 'gatsby-theme-carbon',
options: {
mdxExtensions: ['.mdx'],
isSearchEnabled: true,
iconPath: './src/images/favicon-32.png',
titleType: 'append',
repository: {
baseUrl: 'https://github.com/carbon-design-system/carbon-www',
subDirectory: '',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"classnames": "^2.2.6",
"gatsby": "^2.13.41",
"gatsby-plugin-compile-es6-packages": "^2.1.0",
"gatsby-theme-carbon": "^1.7.0",
"gatsby-theme-carbon": "^1.7.1",
"html-loader": "^0.5.5",
"lodash": "^4.17.15",
"markdown-it": "^9.0.1",
Expand Down
Binary file added src/images/favicon-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/util/hooks/useSearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useEffect } from 'react';

const useAlgoliaSearch = () => {
useEffect(() => {
if (
typeof window === `undefined` ||
typeof window.docsearch === `undefined`
) {
console.warn(`Search has failed to load and now is being disabled`);
} else {
window.docsearch({
apiKey: `296ea0c1d0e96b2b04900d0f4d1a6329`,
indexName: `carbondesignsystem`,
inputSelector: `#doc-search`,
// set this to true if you need to debug css
debug: true,
});
}
});
};

export default useAlgoliaSearch;
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6417,10 +6417,10 @@ gatsby-telemetry@^1.1.11:
stack-utils "1.0.2"
uuid "3.3.2"

gatsby-theme-carbon@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/gatsby-theme-carbon/-/gatsby-theme-carbon-1.7.0.tgz#707db04ae3f69c73937a130b2cc5fc060de89561"
integrity sha512-S/T1SK0tlF0WmG4g8JKsyzvD1B83oBslFwUtklwA/oCU9SJbtlthZYWUtYU+mf27Vgi9tq4qpx3iTUfZzbUTvQ==
gatsby-theme-carbon@^1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/gatsby-theme-carbon/-/gatsby-theme-carbon-1.7.1.tgz#e1f9bbef1257475d628dbe8c2b03c1935ada07a5"
integrity sha512-4ZVUjQMlkaXqkiDAXku4dlYj+5d9g6lUtS3n/w1x4N00aWVGyuqOGF8PM7WtRmbtLpLM7rDDdSzI4ALLWTOC8A==
dependencies:
"@carbon/addons-website" "0.0.1-alpha.21"
"@carbon/elements" "^10.4.0"
Expand Down

1 comment on commit 097dac0

@vercel
Copy link

@vercel vercel bot commented on 097dac0 Aug 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.