Skip to content

Commit

Permalink
Format numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
tinykite committed Apr 4, 2024
1 parent 2034fb9 commit d51cfad
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/components/cap-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ export class CapMap extends LitElement {
return mapping;
}

getFormattedNumber(number) {
return number.toLocaleString();
}

render() {
return html`
<div class="mapRegion">
Expand All @@ -166,42 +170,38 @@ export class CapMap extends LitElement {
: "State and Federal Totals"}
</h3>
<p class="infoBox__text">
${this.activeStats.caseCount}<br /><span
${this.getFormattedNumber(this.activeStats.caseCount)}<br /><span
class="infoBox__textDescriptor"
>Unique cases</span
>
</p>
<p class="infoBox__text">
${this.activeStats.reporterCount}<br /><span
class="infoBox__textDescriptor"
>Reporters</span
>
${this.getFormattedNumber(
this.activeStats.reporterCount,
)}<br /><span class="infoBox__textDescriptor">Reporters</span>
</p>
<p class="infoBox__text">
${this.activeStats.pageCount}<br /><span
${this.getFormattedNumber(this.activeStats.pageCount)}<br /><span
class="infoBox__textDescriptor"
>Pages scanned</span
>
</p>
<h3 class="infoBox__heading">Federal Totals</h3>
<p class="infoBox__text">
${nationalCaselawStats.total.caseCount}<br /><span
class="infoBox__textDescriptor"
>Unique cases</span
>
${this.getFormattedNumber(
nationalCaselawStats.total.caseCount,
)}<br /><span class="infoBox__textDescriptor">Unique cases</span>
</p>
<p class="infoBox__text">
${nationalCaselawStats.total.reporterCount}<br /><span
class="infoBox__textDescriptor"
>Reporters</span
>
${this.getFormattedNumber(
nationalCaselawStats.total.reporterCount,
)}<br /><span class="infoBox__textDescriptor">Reporters</span>
</p>
<p class="infoBox__text">
${nationalCaselawStats.total.pageCount}<br /><span
class="infoBox__textDescriptor"
>Pages scanned</span
>
${this.getFormattedNumber(
nationalCaselawStats.total.pageCount,
)}<br /><span class="infoBox__textDescriptor">Pages scanned</span>
</p>
</div>
Expand Down

0 comments on commit d51cfad

Please sign in to comment.