Skip to content

Commit

Permalink
feat(icherche): add icons to search results
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Sep 26, 2019
1 parent 166618d commit 04c50f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ export interface IChercheData {
geometry: FeatureGeometry;
bbox: [number, number, number, number];
properties: { [key: string]: any };
icon?: string
highlight: {
title: string;
title2?: string;
title3?: string;
title4?: string;
title5?: string;
};
}

Expand Down
10 changes: 7 additions & 3 deletions packages/geo/src/lib/search/shared/sources/icherche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export class IChercheSearchSource extends SearchSource implements TextSearch {
q: this.computeTerm(term),
geometry: true,
bbox: true,
icon: true,
type:
'adresses,codes-postaux,municipalites,mrc,regadmin,lieux,entreprises,bornes'
},
Expand All @@ -283,7 +284,10 @@ export class IChercheSearchSource extends SearchSource implements TextSearch {

const titleHtml = data.highlight.title || data.properties.nom;
const subtitleHtml = data.highlight.title2
? ' <small> ' + data.highlight.title2 + '</small>'
? ' <small style="color: #6f6969"> ' + data.highlight.title2 + '</small>'
: '';
const subtitleHtml2 = data.highlight.title3
? '<br><small style="color: #6f6969"> ' + data.highlight.title3 + '</small>'
: '';

return {
Expand All @@ -303,8 +307,8 @@ export class IChercheSearchSource extends SearchSource implements TextSearch {
dataType: FEATURE,
id,
title: data.properties.nom,
titleHtml: titleHtml + subtitleHtml,
icon: 'map-marker'
titleHtml: titleHtml + subtitleHtml + subtitleHtml2,
icon: data.icon || 'map-marker'
}
};
}
Expand Down

0 comments on commit 04c50f5

Please sign in to comment.