Skip to content

Commit

Permalink
move search help to documentation, increase size of history panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Bulicek committed Oct 1, 2020
1 parent 6413b7a commit 5a135b9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 93 deletions.
4 changes: 2 additions & 2 deletions src/components/universalSearch/searchBar/autosuggest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {when} from 'mobx';
import TimeWindowPicker from './timeWindowPicker';
import Chips from './chips';
import QueryBank from './queryBank';
import Guide from './guide';
import SearchHistory from './searchHistory';
import Suggestions from './suggestions';
import SearchSubmit from './searchSubmit';

Expand Down Expand Up @@ -536,7 +536,7 @@ export default class Autosuggest extends React.Component {
suggestedOnType={this.state.suggestedOnType}
suggestedOnValue={this.state.suggestedOnValue}
/>
<Guide searchHistory={uiState.searchHistory}/>
<SearchHistory history={uiState.searchHistory}/>
</div>
</div>
<QueryBank uiState={uiState} modifyQuery={this.modifyQuery} deleteQuery={this.deleteQuery} />
Expand Down
5 changes: 3 additions & 2 deletions src/components/universalSearch/searchBar/autosuggest.less
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,10 @@
}

.usb-suggestions__guide-history-list {
list-style-type: none;
list-style-type: circle;
overflow-y: scroll;
max-height: 100px;
max-height: 365px;
min-height: 100px;
}

.usb-reset-button {
Expand Down
89 changes: 0 additions & 89 deletions src/components/universalSearch/searchBar/guide.jsx

This file was deleted.

46 changes: 46 additions & 0 deletions src/components/universalSearch/searchBar/searchHistory.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2018 Expedia Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import React from 'react';
import PropTypes from 'prop-types';

const SearchHistory = ({history}) => {
const historyListItems = history.map((searchObject) => (
<li key={searchObject}><code><a href={`/search?${searchObject}`}>{searchObject.split('&').join(', ')}</a></code></li>
));
const historyList =
(<section>
<div><b>History</b></div>
<ul className="usb-suggestions__guide-history-list">
{historyListItems.length ? historyListItems : <li><code>No search history found - searches will be saved here</code></li>}
</ul>
</section>);

return (
<div className="usb-suggestions__guide-wrapper pull-left">
<section>
<div><b><a target="_blank" href="https://expediadotcom.github.io/haystack/docs/ui/ui_universal_search.html#simple-workflow">Need help searching? Click here</a></b></div>
</section>
{historyList}
</div>
);
};

SearchHistory.propTypes = {
history: PropTypes.object.isRequired
};

export default SearchHistory;

0 comments on commit 5a135b9

Please sign in to comment.