Skip to content

Commit 9130c7f

Browse files
authored
Merge pull request #287 from rvsia/useQueryInAlgolia
Include query in algolia for component examples
2 parents 06b4552 + 3b8b866 commit 9130c7f

File tree

1 file changed

+12
-1
lines changed
  • packages/react-renderer-demo/src/app/src/components

1 file changed

+12
-1
lines changed

packages/react-renderer-demo/src/app/src/components/docsearch.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,18 @@ const DocSearch = () => {
5454
handleSelected: (input, event, suggestion) => {
5555
event.button = 0;
5656
const resultUrl = new URL(suggestion.url);
57-
push(`${resultUrl.pathname}${resultUrl.hash ? resultUrl.hash : ''}`);
57+
58+
let query = '';
59+
if (resultUrl.pathname.startsWith('/component-example/')) {
60+
[ 'mui', 'pf4', 'pf3' ].find(mapper => {
61+
if (resultUrl.hash.includes(mapper)){
62+
query = `?mapper=${mapper}`;
63+
return true;
64+
}
65+
});
66+
}
67+
68+
push(`${resultUrl.pathname}${query}${resultUrl.hash ? resultUrl.hash : ''}`);
5869
input.close();
5970
},
6071
// debug: true, // Set debug to true if you want to inspect the dropdown.

0 commit comments

Comments
 (0)