mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
refactor(places): one label for a rating badge
The list rows and the map pins wrote the average with their own copy of the whole star or one decimal rule; both now read ratingBadge.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { ratingBadge } from '../Collections/ratingLabel';
|
||||
import './ratingBadge.css';
|
||||
|
||||
/**
|
||||
@@ -12,8 +13,8 @@ import './ratingBadge.css';
|
||||
* already the whole sentence.
|
||||
*/
|
||||
export function ratingBadgeHtml(rating: number | null | undefined): string {
|
||||
if (typeof rating !== 'number' || !(rating > 0)) return '';
|
||||
const label = Number.isInteger(rating) ? String(rating) : rating.toFixed(1);
|
||||
const label = ratingBadge(rating);
|
||||
if (!label) return '';
|
||||
// Its amber and white live in ratingBadge.css, beside the list's badge of the same look.
|
||||
return `<span class="trek-rating-badge" style="
|
||||
position:absolute;bottom:-4px;right:-4px;
|
||||
|
||||
Reference in New Issue
Block a user