mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-16 17:40:00 +00:00
better search UI
This commit is contained in:
parent
656f5c2561
commit
471f9effcf
@ -10,6 +10,10 @@
|
|||||||
background-image: none;
|
background-image: none;
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|
||||||
|
&.toast-error {
|
||||||
|
background-color: #BD362F;
|
||||||
|
}
|
||||||
|
|
||||||
&.toast-info {
|
&.toast-info {
|
||||||
background-color: #555;
|
background-color: #555;
|
||||||
}
|
}
|
||||||
|
@ -405,3 +405,7 @@ toggle.active .body .toggle {
|
|||||||
*::-webkit-resizer {
|
*::-webkit-resizer {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
search-panel {
|
||||||
|
background: rgba(39, 49, 60, 0.65) !important;
|
||||||
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
input.search-input.form-control(
|
input.search-input.form-control(
|
||||||
type='search',
|
type='search',
|
||||||
[(ngModel)]='query',
|
[(ngModel)]='query',
|
||||||
(ngModelChange)='notFound = false',
|
(ngModelChange)='onQueryChange()',
|
||||||
[class.text-danger]='notFound',
|
[class.text-danger]='notFound',
|
||||||
(click)='$event.stopPropagation()',
|
(click)='$event.stopPropagation()',
|
||||||
(keyup.enter)='findNext()',
|
(keyup.enter)='findNext()',
|
||||||
@ -10,31 +10,27 @@
|
|||||||
placeholder='Search...'
|
placeholder='Search...'
|
||||||
)
|
)
|
||||||
.input-group-append
|
.input-group-append
|
||||||
.btn-group
|
.input-group-text
|
||||||
button.btn.btn-outline-primary(
|
a(
|
||||||
(click)='options.caseSensitive = !options.caseSensitive',
|
(click)='options.caseSensitive = !options.caseSensitive',
|
||||||
[class.active]='options.caseSensitive',
|
[class.text-info]='options.caseSensitive',
|
||||||
ngbTooltip='Case sensitivity',
|
ngbTooltip='Case sensitivity',
|
||||||
placement='bottom'
|
placement='bottom'
|
||||||
)
|
)
|
||||||
i.fa.fa-fw.fa-font
|
i.fa.fa-fw.fa-font
|
||||||
button.btn.btn-outline-primary(
|
a(
|
||||||
(click)='options.regex = !options.regex',
|
(click)='options.regex = !options.regex',
|
||||||
[class.active]='options.regex',
|
[class.text-info]='options.regex',
|
||||||
ngbTooltip='Regular expression',
|
ngbTooltip='Regular expression',
|
||||||
placement='bottom'
|
placement='bottom'
|
||||||
)
|
)
|
||||||
i.fa.fa-fw.fa-asterisk
|
i.fa.fa-fw.fa-asterisk
|
||||||
button.btn.btn-outline-primary(
|
a(
|
||||||
(click)='options.wholeWord = !options.wholeWord',
|
(click)='options.wholeWord = !options.wholeWord',
|
||||||
[class.active]='options.wholeWord',
|
[class.text-info]='options.wholeWord',
|
||||||
ngbTooltip='Whole word',
|
ngbTooltip='Whole word',
|
||||||
placement='bottom'
|
placement='bottom'
|
||||||
)
|
)
|
||||||
i.fa.fa-fw.fa-text-width
|
i.fa.fa-fw.fa-text-width
|
||||||
button.btn.btn-outline(
|
|
||||||
(click)='close.emit()',
|
button.close.text-light.pl-3.pr-2((click)='close.emit()') ×
|
||||||
ngbTooltip='Close',
|
|
||||||
placement='bottom'
|
|
||||||
)
|
|
||||||
i.fa.fa-fw.fa-times
|
|
||||||
|
@ -1,9 +1,20 @@
|
|||||||
:host {
|
:host {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
align-self: center;
|
right: 50px;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 0 0 3px 3px;
|
border-radius: 0 0 3px 3px;
|
||||||
background: rgba(0, 0, 0, .75);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,9 @@ export class SearchPanelComponent {
|
|||||||
@Input() query: string
|
@Input() query: string
|
||||||
@Input() frontend: Frontend
|
@Input() frontend: Frontend
|
||||||
notFound = false
|
notFound = false
|
||||||
options: SearchOptions = {}
|
options: SearchOptions = {
|
||||||
|
incremental: true,
|
||||||
|
}
|
||||||
|
|
||||||
@Output() close = new EventEmitter()
|
@Output() close = new EventEmitter()
|
||||||
|
|
||||||
@ -19,8 +21,13 @@ export class SearchPanelComponent {
|
|||||||
private toastr: ToastrService,
|
private toastr: ToastrService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
findNext () {
|
onQueryChange () {
|
||||||
if (!this.frontend.findNext(this.query, this.options)) {
|
this.notFound = false
|
||||||
|
this.findNext(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
findNext (incremental? = false) {
|
||||||
|
if (!this.frontend.findNext(this.query, { ...this.options, incremental })) {
|
||||||
this.notFound = true
|
this.notFound = true
|
||||||
this.toastr.error('Not found')
|
this.toastr.error('Not found')
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ export interface SearchOptions {
|
|||||||
regex?: boolean
|
regex?: boolean
|
||||||
wholeWord?: boolean
|
wholeWord?: boolean
|
||||||
caseSensitive?: boolean
|
caseSensitive?: boolean
|
||||||
|
incremental?: true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user