1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-24 06:04:04 +03:00

better search UI

This commit is contained in:
Eugene Pankov 2019-12-01 18:52:22 +01:00
parent 656f5c2561
commit 471f9effcf
6 changed files with 41 additions and 18 deletions

View File

@ -10,6 +10,10 @@
background-image: none;
width: auto;
&.toast-error {
background-color: #BD362F;
}
&.toast-info {
background-color: #555;
}

View File

@ -405,3 +405,7 @@ toggle.active .body .toggle {
*::-webkit-resizer {
opacity: 0;
}
search-panel {
background: rgba(39, 49, 60, 0.65) !important;
}

View File

@ -2,7 +2,7 @@
input.search-input.form-control(
type='search',
[(ngModel)]='query',
(ngModelChange)='notFound = false',
(ngModelChange)='onQueryChange()',
[class.text-danger]='notFound',
(click)='$event.stopPropagation()',
(keyup.enter)='findNext()',
@ -10,31 +10,27 @@
placeholder='Search...'
)
.input-group-append
.btn-group
button.btn.btn-outline-primary(
.input-group-text
a(
(click)='options.caseSensitive = !options.caseSensitive',
[class.active]='options.caseSensitive',
[class.text-info]='options.caseSensitive',
ngbTooltip='Case sensitivity',
placement='bottom'
)
i.fa.fa-fw.fa-font
button.btn.btn-outline-primary(
a(
(click)='options.regex = !options.regex',
[class.active]='options.regex',
[class.text-info]='options.regex',
ngbTooltip='Regular expression',
placement='bottom'
)
i.fa.fa-fw.fa-asterisk
button.btn.btn-outline-primary(
a(
(click)='options.wholeWord = !options.wholeWord',
[class.active]='options.wholeWord',
[class.text-info]='options.wholeWord',
ngbTooltip='Whole word',
placement='bottom'
)
i.fa.fa-fw.fa-text-width
button.btn.btn-outline(
(click)='close.emit()',
ngbTooltip='Close',
placement='bottom'
)
i.fa.fa-fw.fa-times
button.close.text-light.pl-3.pr-2((click)='close.emit()') ×

View File

@ -1,9 +1,20 @@
:host {
position: fixed;
width: 400px;
align-self: center;
right: 50px;
z-index: 5;
padding: 10px;
border-radius: 0 0 3px 3px;
background: rgba(0, 0, 0, .75);
border: 1px solid rgba(0, 0, 0, .5);
border-top: 0;
display: flex;
a {
padding-left: 10px;
&:first-child {
padding-left: 0;
}
}
}

View File

@ -11,7 +11,9 @@ export class SearchPanelComponent {
@Input() query: string
@Input() frontend: Frontend
notFound = false
options: SearchOptions = {}
options: SearchOptions = {
incremental: true,
}
@Output() close = new EventEmitter()
@ -19,8 +21,13 @@ export class SearchPanelComponent {
private toastr: ToastrService,
) { }
findNext () {
if (!this.frontend.findNext(this.query, this.options)) {
onQueryChange () {
this.notFound = false
this.findNext(true)
}
findNext (incremental? = false) {
if (!this.frontend.findNext(this.query, { ...this.options, incremental })) {
this.notFound = true
this.toastr.error('Not found')
}

View File

@ -6,6 +6,7 @@ export interface SearchOptions {
regex?: boolean
wholeWord?: boolean
caseSensitive?: boolean
incremental?: true
}
/**