File tree Expand file tree Collapse file tree 3 files changed +22
-5
lines changed
Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 66'use strict'
77
88import React from 'react'
9+ import { Input , Icon } from 'antd'
910import Agent from '../Agent'
1011import './searchbar.less'
1112
@@ -44,6 +45,12 @@ export default class SearchBar extends React.Component {
4445 Agent . emit ( 'search' , '' )
4546 }
4647
48+ emptySearch ( ) {
49+ this . setState ( { keyword : '' } )
50+ Agent . emit ( 'search' , '' )
51+ this . refs . keyword . focus ( )
52+ }
53+
4754 doSearch ( kw ) {
4855 this . setState ( {
4956 keyword : kw
@@ -65,10 +72,11 @@ export default class SearchBar extends React.Component {
6572 }
6673 return (
6774 < div id = "sh-searchbar" >
68- < input
75+ < Input
6976 ref = "keyword"
70- type = "text"
71- placeholder = "keyword"
77+ size = "large"
78+ //placeholder="keyword"
79+ suffix = { this . state . keyword ? < Icon type = "close-circle" onClick = { this . emptySearch . bind ( this ) } /> : null }
7280 value = { this . state . keyword }
7381 onChange = { ( e ) => this . doSearch ( e . target . value ) }
7482 onKeyDown = { ( e ) => ( e . keyCode === 27 && SearchBar . onCancel ( ) ) }
Original file line number Diff line number Diff line change 66 left : 0 ;
77 bottom : 30px ;
88 background : @bg_left_search ;
9- padding : 6 px 20 px 5px 18 px ;
9+ padding : 3 px 10 px 5px 10 px ;
1010 border-top : solid 1px @bg_left * 0.9 ;
1111
1212 input {
1515 outline : 0 ;
1616 color : #fff ;
1717 font-size : 13px ;
18+
19+ & ::placeholder {
20+ color : #333 ;
21+ }
22+ }
23+
24+ i {
25+ color : @font_color_left ;
26+ cursor : pointer ;
1827 }
1928}
You can’t perform that action at this time.
0 commit comments