Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #6319 from gyandeeps/issue6273
Browse files Browse the repository at this point in the history
Properly handle URL bar icon when searching and focus changes
  • Loading branch information
bsclifton authored Jan 18, 2017
2 parents 2c4b720 + 58fbd28 commit 171abbe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/renderer/components/urlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ class UrlBar extends ImmutableComponent {
searchSelectEntry={this.searchSelectEntry}
title={this.props.title}
titleMode={this.props.titleMode}
isSearching={this.props.location !== this.props.urlbar.get('location')}
/>
</div>
{
Expand Down
21 changes: 15 additions & 6 deletions app/renderer/components/urlBarIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ const dndData = require('../../../js/dndData')
const {isSourceAboutUrl} = require('../../../js/lib/appUrlUtil')
const searchIconSize = 16

const getIconCssClass = (ctx) => {
if (ctx.isSearch) {
return 'fa-search'
} else if (ctx.isAboutPage && !ctx.props.titleMode) {
return 'fa-list'
} else if (ctx.isSecure) {
// NOTE: EV style not approved yet; see discussion at https://github.com/brave/browser-laptop/issues/791
return 'fa-lock'
} else if (ctx.inInsecure) {
return 'fa-unlock'
}
}

class UrlBarIcon extends ImmutableComponent {
constructor () {
super()
Expand Down Expand Up @@ -40,7 +53,7 @@ class UrlBarIcon extends ImmutableComponent {
* - is a catch-all for: about pages, files, etc
*/
get isSearch () {
const showSearch = this.props.active
const showSearch = this.props.isSearching && !this.props.titleMode

const defaultToSearch = (!this.isSecure && !this.isInsecure && !showSearch) &&
!this.props.titleMode &&
Expand All @@ -60,11 +73,7 @@ class UrlBarIcon extends ImmutableComponent {
return cx({
urlbarIcon: true,
'fa': true,
// NOTE: EV style not approved yet; see discussion at https://github.com/brave/browser-laptop/issues/791
'fa-lock': this.isSecure,
'fa-unlock': this.isInsecure,
'fa-search': this.isSearch && !this.isAboutPage,
'fa-list': this.isAboutPage && !this.props.titleMode
[ getIconCssClass(this) ]: true
})
}
get iconStyles () {
Expand Down

0 comments on commit 171abbe

Please sign in to comment.