Skip to content

Commit

Permalink
chore(search): Remove search input in v6 temporarily (#3920)
Browse files Browse the repository at this point in the history
* Comment out search input

* Update docs framework to resolve updating issue
  • Loading branch information
jessiehuff authored Mar 22, 2024
1 parent 33226a0 commit e33c84a
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
ToolbarItem,
SkipToContent,
Switch,
SearchInput,
// SearchInput,
ToggleGroup,
ToggleGroupItem
} from '@patternfly/react-core';
Expand All @@ -51,10 +51,10 @@ const HeaderTools = ({
const initialVersion = staticVersions.Releases.find(release => release.latest);
const latestVersion = versions.Releases.find(version => version.latest);
const previousReleases = Object.values(versions.Releases).filter(version => !version.hidden && !version.latest);
const hasSearch = algolia;
// const hasSearch = algolia;
const [isDropdownOpen, setDropdownOpen] = useState(false);
const [searchValue, setSearchValue] = React.useState('');
const [isSearchExpanded, setIsSearchExpanded] = React.useState(false);
// const [searchValue, setSearchValue] = React.useState('');
// const [isSearchExpanded, setIsSearchExpanded] = React.useState(false);
const [isDarkTheme, setIsDarkTheme] = React.useState(false);

const getDropdownItem = (version, isLatest = false) => (
Expand All @@ -63,26 +63,26 @@ const HeaderTools = ({
</DropdownItem>
);

const onChange = (_evt, value) => {
setSearchValue(value);
};
// const onChange = (_evt, value) => {
// setSearchValue(value);
// };

const onToggleExpand = (_evt, isSearchExpanded) => {
setIsSearchExpanded(!isSearchExpanded);
};
// const onToggleExpand = (_evt, isSearchExpanded) => {
// setIsSearchExpanded(!isSearchExpanded);
// };

const toggleDarkTheme = (_evt, selected) => {
const darkThemeToggleClicked = !selected === isDarkTheme
document.querySelector('html').classList.toggle('pf-v5-theme-dark', darkThemeToggleClicked);
setIsDarkTheme(darkThemeToggleClicked);
};

useEffect(() => {
// reattach algolia to input each time search is expanded
if (hasSearch && isSearchExpanded) {
attachDocSearch(algolia, '.ws-global-search .pf-v5-c-text-input-group__text-input', 1000);
}
}, [isSearchExpanded])
// useEffect(() => {
// // reattach algolia to input each time search is expanded
// if (hasSearch && isSearchExpanded) {
// attachDocSearch(algolia, '.ws-global-search .pf-v5-c-text-input-group__text-input', 1000);
// }
// }, [isSearchExpanded])

return (
<Toolbar isFullHeight>
Expand All @@ -109,7 +109,7 @@ const HeaderTools = ({
<Switch id="ws-rtl-switch" label={'RTL'} defaultChecked={isRTL} onChange={() => setIsRTL(isRTL => !isRTL)} />
</ToolbarItem>
)}
{hasSearch && (
{/* {hasSearch && (
<ToolbarItem>
<SearchInput
className="ws-global-search"
Expand All @@ -120,7 +120,7 @@ const HeaderTools = ({
expandableInput={{ isExpanded: isSearchExpanded, onToggleExpand, toggleAriaLabel: 'Expandable search input toggle' }}
/>
</ToolbarItem>
)}
)} */}
<ToolbarItem>
<Button
component="a"
Expand Down

0 comments on commit e33c84a

Please sign in to comment.