|
| 1 | +/* |
| 2 | +Copyright 2015, 2016 OpenMarket Ltd |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +'use strict'; |
| 18 | + |
| 19 | +var React = require('react'); |
| 20 | +var sdk = require('matrix-react-sdk') |
| 21 | +var dis = require('matrix-react-sdk/lib/dispatcher'); |
| 22 | + |
| 23 | +module.exports = React.createClass({ |
| 24 | + displayName: 'SearchBox', |
| 25 | + |
| 26 | + render: function() { |
| 27 | + var TintableSvg = sdk.getComponent('elements.TintableSvg'); |
| 28 | + var EditableText = sdk.getComponent("elements.EditableText"); |
| 29 | + |
| 30 | + var toggleCollapse; |
| 31 | + if (this.props.collapsed) { |
| 32 | + toggleCollapse = <img className="mx_SearchBox_maximise" src="img/maximise.svg" width="10" height="16" alt="<"/>; |
| 33 | + } |
| 34 | + else { |
| 35 | + toggleCollapse = <img className="mx_SearchBox_minimise" src="img/minimise.svg" width="10" height="16" alt="<"/>; |
| 36 | + } |
| 37 | + |
| 38 | + return ( |
| 39 | + <div className="mx_SearchBox"> |
| 40 | + <TintableSvg |
| 41 | + className="mx_SearchBox_searchButton" |
| 42 | + src="img/search.svg" width="21" height="19" |
| 43 | + /> |
| 44 | + <EditableText |
| 45 | + className="mx_SearchBox_search" |
| 46 | + placeholderClassName="mx_SearchBox_searchPlaceholder" |
| 47 | + blurToCancel={ false } |
| 48 | + editable={ true } |
| 49 | + placeholder="Search Vector" |
| 50 | + /> |
| 51 | + { toggleCollapse } |
| 52 | + </div> |
| 53 | + ); |
| 54 | + } |
| 55 | +}); |
0 commit comments