Browse Source

调整搜索框。

oldj 8 years ago
parent
commit
4857a5863b
3 changed files with 21 additions and 4 deletions
  1. 0 0
      app/ui/bundle.js
  2. 11 3
      ui/panel/searchbar.jsx
  3. 10 1
      ui/panel/searchbar.less

File diff suppressed because it is too large
+ 0 - 0
app/ui/bundle.js


+ 11 - 3
ui/panel/searchbar.jsx

@@ -6,6 +6,7 @@
 'use strict'
 
 import React from 'react'
+import { Input, Icon } from 'antd'
 import Agent from '../Agent'
 import './searchbar.less'
 
@@ -44,6 +45,12 @@ export default class SearchBar extends React.Component {
     Agent.emit('search', '')
   }
 
+  emptySearch () {
+    this.setState({keyword: ''})
+    Agent.emit('search', '')
+    this.refs.keyword.focus()
+  }
+
   doSearch (kw) {
     this.setState({
       keyword: kw
@@ -65,10 +72,11 @@ export default class SearchBar extends React.Component {
     }
     return (
       <div id="sh-searchbar">
-        <input
+        <Input
           ref="keyword"
-          type="text"
-          placeholder="keyword"
+          size="large"
+          //placeholder="keyword"
+          suffix={this.state.keyword ? <Icon type="close-circle" onClick={this.emptySearch.bind(this)}/> : null}
           value={this.state.keyword}
           onChange={(e) => this.doSearch(e.target.value)}
           onKeyDown={(e) => (e.keyCode === 27 && SearchBar.onCancel())}

+ 10 - 1
ui/panel/searchbar.less

@@ -6,7 +6,7 @@
   left: 0;
   bottom: 30px;
   background: @bg_left_search;
-  padding: 6px 20px 5px 18px;
+  padding: 3px 10px 5px 10px;
   border-top: solid 1px @bg_left * 0.9;
 
   input {
@@ -15,5 +15,14 @@
     outline: 0;
     color: #fff;
     font-size: 13px;
+
+    &::placeholder {
+      color: #333;
+    }
+  }
+
+  i {
+    color: @font_color_left;
+    cursor: pointer;
   }
 }

Some files were not shown because too many files changed in this diff