All files / web/modules/search/components Search.tsx

63.64% Statements 7/11
100% Branches 2/2
0% Functions 0/2
70% Lines 7/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 28 29 301x   1x 1x 1x   1x               1x                           1x  
import Input from 'antd/lib/input';
import { Push } from 'connected-react-router';
import * as React from 'react';
import styled from 'styled-components';
import withRouter from '../../hoc/withRouter';
 
const SearchContainer = styled.header`
  margin-left: 5px;
`;
 
interface IProps {
  push: Push;
}
 
const Search = ({ push }: IProps) => {
  const handleSearch = (value: string) => {
    if (value) {
      push(`/vyhledat/${value}`);
    }
  };
 
  return (
    <SearchContainer>
      <Input.Search placeholder="Vyhledat článek" onSearch={handleSearch} />
    </SearchContainer>
  );
};
 
export default withRouter(Search);