Skip to content

Commit

Permalink
Merge 4fb690f into 25b9b7d
Browse files Browse the repository at this point in the history
  • Loading branch information
saturninoabril committed Feb 28, 2017
2 parents 25b9b7d + 4fb690f commit 5f15021
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 14 deletions.
7 changes: 6 additions & 1 deletion webapp/components/channel_header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,12 @@ export default class ChannelHeader extends React.Component {
<th className='header-list__members'>
{popoverListMembers}
</th>
<th className='search-bar__container'><NavbarSearchBox showMentionFlagBtns={false}/></th>
<th className='search-bar__container'>
<NavbarSearchBox
showMentionFlagBtns={false}
isFocus={Utils.isMobile()}
/>
</th>
<th>
<div className='dropdown channel-header__links search-btns'>
<OverlayTrigger
Expand Down
32 changes: 26 additions & 6 deletions webapp/components/search_bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ export default class SearchBar extends React.Component {
componentDidMount() {
SearchStore.addSearchTermChangeListener(this.onListenerChange);
this.mounted = true;

if (Utils.isMobile()) {
setTimeout(() => {
document.querySelector('.app__body .sidebar--menu').classList.remove('visible');
});
}
}

componentWillUnmount() {
Expand All @@ -76,6 +82,12 @@ export default class SearchBar extends React.Component {
handleClose(e) {
e.preventDefault();

if (Utils.isMobile()) {
setTimeout(() => {
document.querySelector('.app__body .sidebar--menu').classList.add('visible');
});
}

AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_SEARCH,
results: null
Expand Down Expand Up @@ -261,7 +273,7 @@ export default class SearchBar extends React.Component {
);
}

let clearClass = 'sidebar__clear-icon';
let clearClass = 'sidebar__search-clear';
if (!this.state.isSearching && this.state.searchTerm && this.state.searchTerm.trim() !== '') {
clearClass += ' visible';
}
Expand Down Expand Up @@ -295,13 +307,19 @@ export default class SearchBar extends React.Component {
listComponent={SearchSuggestionList}
providers={this.suggestionProviders}
type='search'
autoFocus={this.props.isFocus}
/>
<span
<div
className={clearClass}
onClick={this.handleClear}
>
<i className='fa fa-times'/>
</span>
<span
className='sidebar__search-clear-x'
aria-hidden='true'
>
{'×'}
</span>
</div>
{isSearching}
{this.renderHintPopover(helpClass)}
</form>
Expand All @@ -314,10 +332,12 @@ export default class SearchBar extends React.Component {
}

SearchBar.defaultProps = {
showMentionFlagBtns: true
showMentionFlagBtns: true,
isFocus: false
};

SearchBar.propTypes = {
showMentionFlagBtns: React.PropTypes.bool,
isCommentsPage: React.PropTypes.bool
isCommentsPage: React.PropTypes.bool,
isFocus: React.PropTypes.bool
};
2 changes: 1 addition & 1 deletion webapp/components/search_results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default class SearchResults extends React.Component {
var currentId = UserStore.getCurrentId();
var searchForm = null;
if (currentId) {
searchForm = <SearchBox/>;
searchForm = <SearchBox isFocus={Utils.isMobile()}/>;
}
var noResults = (!results || !results.order || !results.order.length);
const searchTerm = this.state.searchTerm;
Expand Down
2 changes: 1 addition & 1 deletion webapp/sass/components/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
top: 15px;
}

.sidebar__clear-icon {
.sidebar__search-clear {
@include opacity(.5);
color: $dark-gray;
width: 40px;
Expand Down
24 changes: 19 additions & 5 deletions webapp/sass/responsive/_mobile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@
.icon--refresh {
@include opacity(.6);
color: $black;
right: 33px;
right: 30px;
top: 15px;
}

Expand All @@ -938,12 +938,19 @@
@include single-transition(transform, .35s, ease);
@include translate3d(290px, 0, 0);
border: none;
display: block;
width: 290px;
visibility: hidden;

&.visible {
display: block;
visibility: visible;
}

&.move--left,
&.webrtc--show {
@include translate3d(0, 0, 0);
display: block;
visibility: visible;
}
}

Expand Down Expand Up @@ -1082,15 +1089,22 @@
display: block;
}

.sidebar__clear-icon {
.sidebar__search-clear {
display: block;
top: 6px;
height: 30px;
width: 35px;
margin-right: 18px;
&.visible {
visibility: visible;
}
}

.fa-times {
margin-left: 15px;
.sidebar__search-clear-x {
margin-left: 14px;
font-size: 22px;
font-weight: 700;
opacity: .7;
}

.sidebar--right__close {
Expand Down

0 comments on commit 5f15021

Please sign in to comment.