-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor context for search modal and page
- Loading branch information
1 parent
5e2c99e
commit 4f2aa50
Showing
3 changed files
with
33 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable */ | ||
|
||
import React from 'react'; | ||
import { SearchProvider } from '@site/src/utils/SearchContext'; | ||
|
||
export default function Root({ children }) { | ||
return ( | ||
<SearchProvider> | ||
<div>{children}</div> | ||
</SearchProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-disable */ | ||
|
||
import React, { createContext, useState } from 'react'; | ||
import { allFacets } from './searchConstant'; | ||
|
||
export const SearchContext = createContext(null); | ||
|
||
export const SearchProvider = ({ children }) => { | ||
const [selectedFacets, setSelectedFacets] = useState(allFacets); | ||
|
||
return ( | ||
<SearchContext.Provider | ||
value={{ | ||
selectedFacets, | ||
setSelectedFacets, | ||
}} | ||
> | ||
{children} | ||
</SearchContext.Provider> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.