File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,8 +38,14 @@ class App extends Component {
3838 }
3939
4040 searchAItem = ( term ) => {
41+ const charCode = term . charCodeAt ( ) ;
4142 const data = this . state . data ;
42- let searchResult = data && data . filter ( oneData => oneData . title . toLowerCase ( ) . includes ( term . toLowerCase ( ) ) ) ;
43+ let searchResult ;
44+ if ( charCode <= 128 && ! Number . isNaN ( charCode ) ) {
45+ searchResult = data && data . filter ( oneData => oneData . title_en . includes ( term . trim ( ) . toLowerCase ( ) ) ) ;
46+ } else {
47+ searchResult = data && data . filter ( oneData => oneData . title . toLowerCase ( ) . includes ( term . trim ( ) . toLowerCase ( ) ) ) ;
48+ }
4349 searchResult = term ? searchResult : '' ;
4450 this . setState ( { searchResult} ) ;
4551 }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import React from 'react';
22import { Link } from 'react-router-dom' ;
33
44export default ( { id, title, style = { } } ) => (
5- < div key = { id } className = "card c-card" style = { style } log = { console . log ( 'Card' ) } >
5+ < div key = { id } className = "card c-card" style = { style } >
66 < Link to = { `/${ id } ` } >
77 < h4 > { title } </ h4 >
88 </ Link >
Original file line number Diff line number Diff line change @@ -19,4 +19,4 @@ export default class HeaderHome extends PureComponent {
1919 </ header >
2020 )
2121 }
22- }
22+ }
You can’t perform that action at this time.
0 commit comments