refactor: extract the price formatter
This commit is contained in:
parent
1aa45f9270
commit
fe032622fa
|
@ -5,14 +5,9 @@ title: Products and Services
|
||||||
|
|
||||||
import ListingPage from "~/components/ListingPage.astro";
|
import ListingPage from "~/components/ListingPage.astro";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import priceFormatter from "~/price-formatter";
|
||||||
import products from "~/products.json";
|
import products from "~/products.json";
|
||||||
|
|
||||||
export const priceFormatter = new Intl.NumberFormat('en-GB', {
|
|
||||||
currency: 'GBP',
|
|
||||||
maximumSignificantDigits: 2,
|
|
||||||
style: 'currency',
|
|
||||||
});
|
|
||||||
|
|
||||||
<div class="space-y-12">
|
<div class="space-y-12">
|
||||||
{products.map((product) => (
|
{products.map((product) => (
|
||||||
<article>
|
<article>
|
||||||
|
|
7
src/price-formatter.ts
Normal file
7
src/price-formatter.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const priceFormatter = new Intl.NumberFormat('en-GB', {
|
||||||
|
currency: 'GBP',
|
||||||
|
maximumSignificantDigits: 2,
|
||||||
|
style: 'currency',
|
||||||
|
});
|
||||||
|
|
||||||
|
export default priceFormatter;
|
Loading…
Reference in a new issue