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

Commit

Permalink
Fix: Url bar icon for search mode (fixes #6273)
Browse files Browse the repository at this point in the history
  • Loading branch information
gyandeeps authored and mrose17 committed Jan 6, 2017
1 parent 0fe4c02 commit 763d778
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
24 changes: 17 additions & 7 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 @@ -41,8 +54,9 @@ class UrlBarIcon extends ImmutableComponent {
* - is a catch-all for: about pages, files, etc
*/
get isSearch () {
const showSearch = this.props.active &&
this.props.loading === false
const showSearch = this.props.isSearching &&
this.props.loading === false &&
!this.props.titleMode

const defaultToSearch = (!this.isSecure && !this.isInsecure && !showSearch) &&
!this.props.titleMode &&
Expand All @@ -63,11 +77,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
1 change: 1 addition & 0 deletions js/components/urlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,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

0 comments on commit 763d778

Please sign in to comment.