-
-
Notifications
You must be signed in to change notification settings - Fork 439
/
Copy pathsearch-bar.tsx
38 lines (29 loc) · 988 Bytes
/
search-bar.tsx
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
import * as React from 'react';
export class SearchBar extends React.Component<SearchBar.Props> {
constructor(props: Readonly<SearchBar.Props>) {
super(props);
this.handleFilterTextChange = this.handleFilterTextChange.bind(this);
}
render(): React.ReactNode {
return <input
className={SearchBar.Styles.SEARCH_BAR_CLASS}
type='text'
placeholder='Search'
size={1}
value={this.props.filterText}
onChange={this.handleFilterTextChange}
/>;
}
private handleFilterTextChange(event: React.ChangeEvent<HTMLInputElement>): void {
this.props.onFilterTextChanged(event.target.value);
}
}
export namespace SearchBar {
export interface Props {
filterText: string;
onFilterTextChanged(filterText: string): void;
}
export namespace Styles {
export const SEARCH_BAR_CLASS = 'search-bar';
}
}