Skip to content

Commit 1b09e7d

Browse files
committed
调整搜索框。
1 parent ab3d9ac commit 1b09e7d

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

app/ui/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/panel/searchbar.jsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
'use strict'
77

88
import React from 'react'
9+
import { Input, Icon } from 'antd'
910
import Agent from '../Agent'
1011
import './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())}

ui/panel/searchbar.less

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
left: 0;
77
bottom: 30px;
88
background: @bg_left_search;
9-
padding: 6px 20px 5px 18px;
9+
padding: 3px 10px 5px 10px;
1010
border-top: solid 1px @bg_left * 0.9;
1111

1212
input {
@@ -15,5 +15,14 @@
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
}

0 commit comments

Comments
 (0)