File size: 681 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { PromptIcon } from '@automattic/command-palette';
import clsx from 'clsx';
import { useDispatch } from 'calypso/state';
import { openCommandPalette } from 'calypso/state/command-palette/actions';
import SidebarMenuItem from '../menu-item';

export const SidebarSearch = ( { tooltip, onClick } ) => {
	const dispatch = useDispatch();
	const showCommandPalette = () => {
		dispatch( openCommandPalette() );
		onClick();
	};
	return (
		<>
			<SidebarMenuItem
				onClick={ showCommandPalette }
				className={ clsx( 'sidebar__item-search', {
					'is-active': false,
				} ) }
				tooltip={ tooltip }
				tooltipPlacement="top"
				icon={ <PromptIcon /> }
			/>
		</>
	);
};