File
Implements
Metadata
selector |
no-search-result |
styleUrls |
./no-result.component.scss |
templateUrl |
./no-result.component.html |
fifthBulletLabel
|
Type : string
|
|
firstBulletLabel
|
Type : string
|
|
fourthBulletLabel1
|
Type : string
|
|
fourthBulletLabel2
|
Type : string
|
|
fourthBulletLabel3
|
Type : string
|
|
secondBulletLabel
|
Type : string
|
|
thirdBulletLabel
|
Type : string
|
|
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { LabelService } from 'src/app/core/services/label-service/label-service.service';
import { PublicationService } from 'src/app/core/services/publication-service/publication.service';
import { LoadingIndicatorService } from 'src/app/core/services/loading-indicator.service';
import { ConstantsService } from 'src/app/shared/constants/constants.service';
@Component ({
selector: 'no-search-result',
templateUrl: './no-result.component.html',
styleUrls: ['./no-result.component.scss']
})
export class NoResultComponent implements OnInit {
contactLink;
currentPublication;
groupLink;
searchQ;
// Labels
zeroHeaderLabel: string;
firstBulletLabel: string;
secondBulletLabel: string;
thirdBulletLabel: string;
fourthBulletLabel1: string;
fourthBulletLabel2: string;
fourthBulletLabel3: string;
fifthBulletLabel: string;
constructor(
public loadingService: LoadingIndicatorService,
public route: Router,
public activeRoute: ActivatedRoute,
private labelService: LabelService,
private publicationService: PublicationService,
private constantsService: ConstantsService
) {}
ngOnInit() {
this.currentPublication = this.publicationService.getPublicationPath();
this.contactLink = `${this.currentPublication}${this.constantsService.CONTACT_US}`;
this.labelService.getLabel('noResultsFound').then(res => { this.zeroHeaderLabel = res; });
this.labelService.getLabel('noResultTextLine1').then(res => { this.firstBulletLabel = res; });
this.labelService.getLabel('noResultTextLine2').then(res => { this.secondBulletLabel = res; });
this.labelService.getLabel('noResultTextLine3').then(res => { this.thirdBulletLabel = res; });
this.labelService.getLabel('noResultTextLine4intro').then(res => { this.fourthBulletLabel1 = res; });
this.labelService.getLabel('noResultTextLine4middle').then(res => { this.fourthBulletLabel2 = res; });
this.labelService.getLabel('noResultTextLine4end').then(res => { this.fourthBulletLabel3 = res; });
this.labelService.getLabel('noResultTextLine5').then(res => { this.fifthBulletLabel = res; });
// Create new route to group site
let newRoute = this.route.url;
newRoute = newRoute.split('?')[0];
// Change to group publication
newRoute = newRoute.replace(this.currentPublication, '/group');
this.groupLink = newRoute;
// If on site search, pass the search query
if (this.activeRoute.snapshot.queryParams.q) {
this.searchQ = {
q: this.activeRoute.snapshot.queryParams.q
};
}
// Remove the below line (71) when R32 will live, this is a temporary fix to link to existing Group site for now.
this.groupLink = "https://www.skf.com/group/system/SiteSearchResults.html?q="+this.activeRoute.snapshot.queryParams.q;
}
}
<div class="no-result">
<div class="not-found">
<h2>{{zeroHeaderLabel}}</h2>
<ul>
<li>{{firstBulletLabel}}</li>
<li>{{secondBulletLabel}}</li>
<li>{{thirdBulletLabel}}</li>
<!--<li>{{fourthBulletLabel1}} <a class="group" [routerLink]="[groupLink]" [queryParams]="searchQ">{{fourthBulletLabel2}} {{fourthBulletLabel3}}</a></li>-->
<!-- Re-open line 8 <li> and remove line 10 <li> when site will live-->
<li>{{fourthBulletLabel1}} <a class="group" href="{{groupLink}}" >{{fourthBulletLabel2}} {{fourthBulletLabel3}}</a></li>
<li><a [routerLink]="contactLink">{{fifthBulletLabel}}</a></li>
</ul>
</div>
</div>
@import "src/app/styles/helpers";
.no-result {
width: 100%;
display: flex;
justify-content: center;
.not-found {
.group {
color: $blue;
&:hover {
text-decoration: underline;
color: $dark-blue;
}
}
}
}
Legend
Html element with directive