Skip to content

Commit

Permalink
Remove fraction digits from numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Greenheart committed Jun 18, 2024
1 parent 4d44022 commit 2e81201
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/components/company/CompanyEmissions.astro
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ const biogenicEmissions = {
)}
</div>
<span class="rounded-full bg-gray-800 px-4 py-2 font-bold md:text-base">
{emission.value.toLocaleString('sv-SE')}
{emission.value.toLocaleString('sv-SE', {
maximumFractionDigits: 0,
})}
</span>
</div>
) : null,
Expand Down Expand Up @@ -116,7 +118,9 @@ const biogenicEmissions = {
: 'bg-gray-800',
)}
>
{biogenicEmissions.value.toLocaleString('sv-SE')}
{biogenicEmissions.value.toLocaleString('sv-SE', {
maximumFractionDigits: 0,
})}
</span>
</div>
</Card>
Expand Down
12 changes: 9 additions & 3 deletions src/components/company/CompanyFacts.astro
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ const totalEmissionsVerified =
<div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 text-sm">
<h3>Omsättning ({year})</h3>
<p class="text-sm text-orange-250">
{company.baseFacts[year].turnover.toLocaleString('sv-SE') +
{company.baseFacts[year].turnover.toLocaleString('sv-SE', {
maximumFractionDigits: 0,
}) +
' ' +
company.baseFacts[year].unit}
</p>
Expand All @@ -86,7 +88,9 @@ const totalEmissionsVerified =
<div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 text-sm">
<h3>Antal anställda ({year})</h3>
<p class="text-sm text-orange-250">
{company.baseFacts[year]?.employees.toLocaleString('sv-SE')}
{company.baseFacts[year]?.employees.toLocaleString('sv-SE', {
maximumFractionDigits: 0,
})}
</p>
</div>
)
Expand Down Expand Up @@ -119,7 +123,9 @@ const totalEmissionsVerified =
</div>

<p class="text-3xl leading-none tracking-tight text-orange-250 sm:text-4xl md:text-5xl lg:text-6xl">
{totalEmissions.toLocaleString('sv-SE')}
{totalEmissions.toLocaleString('sv-SE', {
maximumFractionDigits: 0,
})}
</p>
</Card>
)
Expand Down
8 changes: 6 additions & 2 deletions src/components/company/Scope3Emissions.astro
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ const nonStandardCategoriesCount = getNonStandardCategories(emissions).length
{title}
{description}
{verified}
value={value?.toLocaleString('sv-SE')}
value={value?.toLocaleString('sv-SE', {
maximumFractionDigits: 0,
})}
/>
))}
</div>
Expand All @@ -243,7 +245,9 @@ const nonStandardCategoriesCount = getNonStandardCategories(emissions).length
{title}
{description}
{verified}
value={value?.toLocaleString('sv-SE')}
value={value?.toLocaleString('sv-SE', {
maximumFractionDigits: 0,
})}
/>
))}
</div>
Expand Down

0 comments on commit 2e81201

Please sign in to comment.