(front) Improve search result stype

Template to show results with glyphicon

(cherry picked from commit 550d8e7b343dc262be87182ae13f231ccc995b55)

Improve style
Stealing CSS from the demo site

(cherry picked from commit 75bebac0ac6080a0210d2b156a14f8a0f70067db)
This commit is contained in:
2021-08-20 16:38:43 +02:00
parent 124a30ad8c
commit f37ce410eb
3 changed files with 49 additions and 5 deletions

View File

@@ -34,5 +34,44 @@
border-radius: 50%; border-radius: 50%;
background-color: #9b59b6; background-color: #9b59b6;
margin: 0 auto; margin: 0 auto;
}
/* Style for autocompletion */
/* Stolen from https://ng-bootstrap.github.io/#/components/typeahead/examples */
::ng-deep .dropdown-item {
display: block;
width: 100%;
padding: .25rem 1.5rem;
clear: both;
font-weight: 400;
color: #212529;
text-align: inherit;
white-space: nowrap;
background-color: transparent;
border: 0
}
::ng-deep .dropdown-item:focus,
::ng-deep .dropdown-item:hover {
color: #16181b;
text-decoration: none;
background-color: #f8f9fa
}
::ng-deep .dropdown-item.active,
::ng-deep .dropdown-item:active {
color: #fff;
text-decoration: none;
background-color: #007bff
}
::ng-deep .dropdown-item.disabled,
::ng-deep .dropdown-item:disabled {
color: #6c757d;
pointer-events: none;
background-color: transparent
}
::ng-deep .dropdown-menu.show {
display: block
} }

View File

@@ -77,6 +77,14 @@
</div> </div>
</div> </div>
<ng-template #rt let-r="result" let-t="term">
<!-- glyphicon glyphicon-cd -->
<span *ngIf="r.type == 'artist'" class="glyphicon glyphicon-user"></span>
<span *ngIf="r.type == 'album'" class="glyphicon glyphicon-cd"></span>
&nbsp; <ngb-highlight [result]="r.name" [term]="t"></ngb-highlight>
</ng-template>
<form class="navbar-form"> <form class="navbar-form">
<div class="form-group" style="display:inline;"> <div class="form-group" style="display:inline;">
<div class="input-group" style="display:table;"> <div class="input-group" style="display:table;">
@@ -87,6 +95,7 @@
id="searchSuggest" id="searchSuggest"
[(ngModel)]="searchTerm" [(ngModel)]="searchTerm"
[ngbTypeahead]="search" [ngbTypeahead]="search"
[resultTemplate]="rt"
(selectItem)="onSelectSearch($event)"> (selectItem)="onSelectSearch($event)">
</div> </div>
</div> </div>

View File

@@ -1,8 +1,4 @@
export class Suggested { export class Suggested {
name: string; name: string;
type: string; type: string;
public toString() : string {
return `${this.name} (${this.type})`;
}
} }