Skip to content

Commit

Permalink
SearchBar added
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuess committed Jan 4, 2021
1 parent c48f44a commit 4683b29
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/components/Views/FacetedSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import React, { useEffect } from 'react';
import { OverridableContext } from 'react-overridable';
import { Link } from 'react-router-dom';
import _truncate from 'lodash/truncate';

import { Portal } from 'react-portal';
import { Navigation } from '@plone/volto/components';

import {
Button,
Checkbox,
Expand All @@ -23,6 +27,7 @@ import {
Error,
ReactSearchKit,
ResultsLoader,
SearchBar,
withState,
} from 'react-searchkit';

Expand Down Expand Up @@ -313,6 +318,8 @@ const FacetedSearch = ({ data, location }) => {

const dispatch = useDispatch();

const [isClient, setIsClient] = React.useState(null);
React.useEffect(() => setIsClient(true), []);

const searchApi = new ESSearchApi({
axios: {
Expand Down Expand Up @@ -343,6 +350,27 @@ const FacetedSearch = ({ data, location }) => {
eventListenerEnabled={true}
initialQueryState={initialState}
>
<div>
debug1:
{console.log(
'debug1',
location,
isClient,
document.querySelectorAll('nav.navigation'),
)}
</div>
{location.pathname?.startsWith('/dokumentation') && (
<Portal
node={
isClient &&
document.querySelectorAll('nav.navigation') &&
document.querySelectorAll('nav.navigation')[0]
}
>
<div>Here comes the SearchBar</div>
<SearchBar />
</Portal>
)}
<Container>
<Grid relaxed style={{ padding: '2em 0' }}>
<Grid.Row>
Expand Down

0 comments on commit 4683b29

Please sign in to comment.