You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			33 lines
		
	
	
		
			825 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			33 lines
		
	
	
		
			825 B
		
	
	
	
		
			TypeScript
		
	
| import React from 'react';
 | |
| import { useSelector } from 'react-redux';
 | |
| import { getConversationsCount } from '../state/selectors/conversations';
 | |
| import { SessionIconButton } from './icon';
 | |
| 
 | |
| type Props = {
 | |
|   searchString: string;
 | |
|   onChange: any;
 | |
|   placeholder: string;
 | |
| };
 | |
| 
 | |
| export const SessionSearchInput = (props: Props) => {
 | |
|   const { searchString, onChange, placeholder } = props;
 | |
| 
 | |
|   const convoCount = useSelector(getConversationsCount);
 | |
| 
 | |
|   // just after onboard we only have a conversation with ourself
 | |
|   if (convoCount <= 1) {
 | |
|     return null;
 | |
|   }
 | |
| 
 | |
|   return (
 | |
|     <div className="session-search-input">
 | |
|       <SessionIconButton iconSize="medium" iconType="search" />
 | |
|       <input
 | |
|         value={searchString}
 | |
|         onChange={e => onChange(e.target.value)}
 | |
|         placeholder={placeholder}
 | |
|       />
 | |
|     </div>
 | |
|   );
 | |
| };
 |