forked from wizeline/react-certification-2020
-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathInputTextIcon.jsx
More file actions
71 lines (64 loc) · 1.59 KB
/
InputTextIcon.jsx
File metadata and controls
71 lines (64 loc) · 1.59 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React from 'react';
import styled from 'styled-components';
const InputTextIcon = ({ path }) => {
return (
<Wrapper data-testid="searchTextWrapper">
<SvgWrapper>
<StyledSvg focusable="false" viewBox="0 0 24 24">
{path || (
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" />
)}
</StyledSvg>
</SvgWrapper>
<InputWrapper>
<StyledInputText />
</InputWrapper>
</Wrapper>
);
};
export default InputTextIcon;
const Wrapper = styled.div`
position: relative;
background-color: #bebebe;
margin: 0% 3%;
border-radius: 25px;
@media screen and (max-width: 280px) {
width: 65%;
}
`;
const SvgWrapper = styled.div`
height: 100%;
display: flex;
padding: 0px 8px;
position: absolute;
align-items: center;
pointer-events: none;
justify-content: center;
`;
const StyledSvg = styled.svg`
fill: #525252;
width: 1em;
height: 1em;
display: inline-block;
font-size: 1.5rem;
transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
flex-shrink: 0;
user-select: none;
`;
const InputWrapper = styled.div`
display: inline-flex;
position: relative;
align-items: center;
`;
const StyledInputText = styled.input`
width: 95%;
padding: 8px 5px;
font-size: 1em;
padding-left: calc(1em + 25px);
border: none;
background-color: transparent;
color: #424242;
&:focus {
outline: none;
}
`;