-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This updates the look of the search control, adds a hint about the slash shortcut, adds highlighting of fuzzy search results, and addresses a few edge case UX failures. It moves to using a fork of Ember Power Select to handle an edge case where pressing escape would put the control in an undesirable active-but-not-open state.
- Loading branch information
Showing
15 changed files
with
319 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Component from '@ember/component'; | ||
import { tagName } from '@ember-decorators/component'; | ||
import { computed, get } from '@ember/object'; | ||
import { alias } from '@ember/object/computed'; | ||
|
||
@tagName('') | ||
export default class GlobalSearchMatch extends Component { | ||
@alias('match.fuzzySearchMatches.firstObject') firstMatch; | ||
@alias('firstMatch.indices.firstObject') firstIndices; | ||
|
||
@computed('match.name') | ||
get label() { | ||
return get(this, 'match.name') || ''; | ||
} | ||
|
||
@computed('label', 'firstIndices.[]') | ||
get beforeHighlighted() { | ||
return this.label.substring(0, this.firstIndices[0]); | ||
} | ||
|
||
@computed('label', 'firstIndices.[]') | ||
get highlighted() { | ||
return this.label.substring(this.firstIndices[0], this.firstIndices[1] + 1); | ||
} | ||
|
||
@computed('label', 'firstIndices.[]') | ||
get afterHighlighted() { | ||
return this.label.substring(this.firstIndices[1] + 1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
.global-search-container { | ||
position: absolute; | ||
width: 100%; | ||
left: 0; | ||
top: 0; | ||
bottom: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
.global-search { | ||
width: 30em; | ||
|
||
@media #{$mq-hidden-gutter} { | ||
width: 20em; | ||
} | ||
|
||
.ember-power-select-trigger { | ||
background: $nomad-green-darker; | ||
border: 0; | ||
|
||
.icon { | ||
margin-top: 1px; | ||
margin-left: 2px; | ||
|
||
fill: white; | ||
opacity: 0.7; | ||
} | ||
|
||
.placeholder { | ||
opacity: 0.7; | ||
display: inline-block; | ||
padding-left: 2px; | ||
transform: translateY(-1px); | ||
font-weight: $weight-semibold; | ||
} | ||
|
||
.shortcut { | ||
position: absolute; | ||
right: 5px; | ||
top: 5px; | ||
bottom: 5px; | ||
width: 1.4rem; | ||
padding-top: 3px; | ||
text-align: center; | ||
opacity: 0.7; | ||
background: $nomad-green-dark; | ||
font-weight: $weight-semibold; | ||
} | ||
|
||
&.ember-power-select-trigger--active { | ||
background: white; | ||
border-color: white; | ||
|
||
.icon { | ||
fill: black; | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
|
||
.ember-basic-dropdown-content-wormhole-origin { | ||
position: absolute; | ||
top: 0; | ||
width: 100%; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{{#if firstIndices}} | ||
{{beforeHighlighted}}<span class='highlighted'>{{highlighted}}</span>{{afterHighlighted}} | ||
{{else}} | ||
{{label}} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{{x-icon "search" class="is-small"}} | ||
{{#unless select.isOpen}} | ||
<span class='placeholder'>Search</span> | ||
{{/unless}} | ||
<span class='placeholder'>Jump to</span> | ||
{{/unless}} | ||
{{#if (not (or select.isActive select.isOpen))}} | ||
<span class='shortcut' title="Type '/' to search">/</span> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.