Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
hide search
Browse files Browse the repository at this point in the history
  • Loading branch information
Niharika Khanna committed Jun 9, 2017
1 parent 284479e commit 1441aa6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
7 changes: 7 additions & 0 deletions server/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ var conf = convict({
default: "",
env: "FORCE_AB_TESTS",
arg: "force-ab-tests"
},
disableSearch: {
doc: "If true, then hide the search bar",
format: Boolean,
default: true,
env: "DISABLE_SEARCH",
arg: "disable-search"
}
});

Expand Down
1 change: 1 addition & 0 deletions server/src/pages/shotindex/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ exports.createModel = function(req) {
};
serverModel.shots = req.shots;
serverModel.downloadUrls = {};
serverModel.disableSearch = req.config.disableSearch;
for (let shot of req.shots) {
if (shot.favicon) {
shot.favicon = createProxyUrl(req, shot.favicon);
Expand Down
16 changes: 11 additions & 5 deletions server/src/pages/shotindex/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ class Body extends React.Component {
<div className="column-space full-height default-color-scheme">
<div id="shot-index-header" className="header">
<h1><a href="/shots">Firefox <strong>Screenshots</strong> <sup>Beta</sup></a></h1>
<form onSubmit={ this.onSubmitForm.bind(this) }>
<span className="search-label" />
<input type="search" id="search" ref="search" maxLength="100" placeholder="search my shots" defaultValue={this.state.defaultSearch} onChange={this.onChangeSearch.bind(this)} />
<div className="clear-search" title="clear search" onClick={this.onClearSearch.bind(this)}></div>
</form>
{this.props.disableSearch ? null : this.renderSearchForm()}
</div>
<div id="shot-index" className="flex-1">
{ this.renderShots() }
Expand Down Expand Up @@ -109,6 +105,16 @@ class Body extends React.Component {
);
}

renderSearchForm() {
return (
<form onSubmit={ this.onSubmitForm.bind(this) }>
<span className="search-label" />
<input type="search" id="search" ref="search" maxLength="100" placeholder="search my shots" defaultValue={this.state.defaultSearch} onChange={this.onChangeSearch.bind(this)} />
<div className="clear-search" title="clear search" onClick={this.onClearSearch.bind(this)}></div>
</form>
);
}

onSubmitForm(e) {
e.preventDefault();
let val = ReactDOM.findDOMNode(this.refs.search).value;
Expand Down

0 comments on commit 1441aa6

Please # to comment.