1- import React from ' react' ;
1+ import React from " react" ;
22
33interface SearchBoxProps {
4- onChange : ( searchText : string ) => void ;
54 searchText : string ;
5+ onChange ( searchText : string ) : void ;
66}
7- function SearchBox ( { onChange, searchText } : SearchBoxProps ) {
7+
8+ const SearchBox : React . FC < SearchBoxProps > = ( { onChange, searchText } ) => {
89 const handleChange = ( event : React . ChangeEvent < HTMLInputElement > ) : void => {
910 onChange ( event . target . value ) ;
1011 } ;
1112
1213 return (
1314 < label
1415 style = { {
15- backgroundColor : '#fff' ,
16- display : 'inline-flex' ,
17- alignItems : 'center' ,
18- padding : '12px 14px 13px 15px' ,
19- boxShadow : '0 1px 3px rgba(0, 0, 0, .1)' ,
20- } } >
21- < i style = { { transform : 'rotate(0deg)' , display : 'flex' } } >
16+ backgroundColor : "#fff" ,
17+ display : "inline-flex" ,
18+ alignItems : "center" ,
19+ padding : "0px 14px" ,
20+ boxShadow : "0 1px 3px rgba(0, 0, 0, .1)" ,
21+ height : "45px"
22+ } }
23+ >
24+ < i style = { { transform : "rotate(0deg)" , display : "flex" } } >
2225 < svg
2326 stroke = "rgba(0, 0, 0, 0.3)"
2427 strokeWidth = "3px"
2528 fill = "none"
26- style = { { width : '16px' , height : '16px' } }
27- viewBox = "0 0 50 50" >
29+ style = { { width : "16px" , height : "16px" } }
30+ viewBox = "0 0 50 50"
31+ >
2832 < circle cx = "17.82" cy = "18.11" r = "16.21" />
2933 < line x1 = "29.28" y1 = "29.57" x2 = "48.21" y2 = "48.5" />
3034 </ svg >
3135 </ i >
3236 < input
3337 style = { {
34- marginLeft : ' 10px' ,
35- fontSize : ' 16px' ,
36- border : ' none' ,
37- letterSpacing : ' 0.3px' ,
38- color : ' gba(0,0,0,0.8)' ,
39- outlineWidth : '0' ,
38+ marginLeft : " 10px" ,
39+ fontSize : " 16px" ,
40+ border : " none" ,
41+ letterSpacing : " 0.3px" ,
42+ color : " gba(0,0,0,0.8)" ,
43+ outlineWidth : "0"
4044 } }
4145 type = "text"
4246 placeholder = "Search..."
@@ -46,29 +50,34 @@ function SearchBox({ onChange, searchText }: SearchBoxProps) {
4650 />
4751 </ label >
4852 ) ;
49- }
53+ } ;
5054
5155interface HeaderProps {
52- onSearchChange : ( searchText : string ) => void ;
5356 searchText : string ;
57+ onSearchChange ( searchText : string ) : void ;
5458}
55- function Header ( { onSearchChange, searchText } : HeaderProps ) {
59+
60+ const Header : React . FC < HeaderProps > = ( { searchText, onSearchChange } ) => {
5661 return (
5762 < header
5863 style = { {
59- padding : '24px' ,
60- backgroundColor : '#fafafa' ,
61- borderColor : 'rgba(0,0,0,.1)' ,
62- borderBottomWidth : '1px' ,
63- borderBottomStyle : 'solid' ,
64- position : 'fixed' ,
64+ paddingLeft : "24px" ,
65+ height : "72px" ,
66+ display : "flex" ,
67+ alignItems : "center" ,
68+ backgroundColor : "#fafafa" ,
69+ borderColor : "rgba(0,0,0,.1)" ,
70+ borderBottomWidth : "1px" ,
71+ borderBottomStyle : "solid" ,
72+ position : "fixed" ,
6573 top : 0 ,
6674 left : 0 ,
67- right : 0 ,
68- } } >
75+ right : 0
76+ } }
77+ >
6978 < SearchBox onChange = { onSearchChange } searchText = { searchText } />
7079 </ header >
7180 ) ;
72- }
81+ } ;
7382
7483export default Header ;
0 commit comments