(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:
@@ -34,5 +34,44 @@
|
||||
border-radius: 50%;
|
||||
background-color: #9b59b6;
|
||||
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
|
||||
}
|
||||
|
||||
@@ -77,6 +77,14 @@
|
||||
</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>
|
||||
<ngb-highlight [result]="r.name" [term]="t"></ngb-highlight>
|
||||
</ng-template>
|
||||
|
||||
|
||||
<form class="navbar-form">
|
||||
<div class="form-group" style="display:inline;">
|
||||
<div class="input-group" style="display:table;">
|
||||
@@ -87,6 +95,7 @@
|
||||
id="searchSuggest"
|
||||
[(ngModel)]="searchTerm"
|
||||
[ngbTypeahead]="search"
|
||||
[resultTemplate]="rt"
|
||||
(selectItem)="onSelectSearch($event)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
export class Suggested {
|
||||
name: string;
|
||||
type: string;
|
||||
|
||||
public toString() : string {
|
||||
return `${this.name} (${this.type})`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user