Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(PPDSE-2397): chore-ppdse-2397-search-mobile-menu #362

Merged
merged 5 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions site/components/search/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ const SearchIconContainer = styled(Visible)`
${getSpacingCssFromTheme('marginBottom', 'space010')};
`;

export const Search: React.FC = () => {
interface SearchProps {
sidebarOpen?: boolean;
}

export const Search: React.FC<SearchProps> = ({sidebarOpen}) => {
const searchButtonRef = React.useRef(null);
const [isOpen, setIsOpen] = React.useState(false);
const [initialQuery, setInitialQuery] = React.useState<string | undefined>(
Expand Down Expand Up @@ -52,19 +56,21 @@ export const Search: React.FC = () => {
return (
<>
<SearchIconContainer xs sm md>
<IconButton
aria-label="Search"
data-testid="search-icon-button"
overrides={{
stylePreset: 'iconButtonMinimalPrimary',
}}
ref={searchButtonRef}
onClick={onOpen}
>
<IconFilledSearch
overrides={{size: 'iconSize020', stylePreset: 'inkContrast'}}
/>
</IconButton>
{sidebarOpen ? undefined : (
<IconButton
aria-label="Search"
data-testid="search-icon-button"
overrides={{
stylePreset: 'iconButtonMinimalPrimary',
}}
ref={searchButtonRef}
onClick={onOpen}
>
<IconFilledSearch
overrides={{size: 'iconSize020', stylePreset: 'inkContrast'}}
/>
</IconButton>
)}
</SearchIconContainer>
<Visible lg xl>
<Button
Expand Down
2 changes: 1 addition & 1 deletion site/components/site-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const SiteHeader = React.forwardRef<HeaderRef, HeaderProps>(
>
<NewsKitLogo />
</Link>
<Search />
<Search sidebarOpen={sidebarOpen} />
</GridLayout>
</Visible>
<Visible lg xl>
Expand Down