From fe032622faeb667192faa0fae86d047d228f4150 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 23 Oct 2023 00:50:08 +0100 Subject: [PATCH] refactor: extract the price formatter --- src/pages/pricing.mdx | 7 +------ src/price-formatter.ts | 7 +++++++ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 src/price-formatter.ts diff --git a/src/pages/pricing.mdx b/src/pages/pricing.mdx index bc9e9f29..e6c29784 100644 --- a/src/pages/pricing.mdx +++ b/src/pages/pricing.mdx @@ -5,14 +5,9 @@ title: Products and Services import ListingPage from "~/components/ListingPage.astro"; import _ from "lodash"; +import priceFormatter from "~/price-formatter"; import products from "~/products.json"; -export const priceFormatter = new Intl.NumberFormat('en-GB', { - currency: 'GBP', - maximumSignificantDigits: 2, - style: 'currency', -}); -
{products.map((product) => (
diff --git a/src/price-formatter.ts b/src/price-formatter.ts new file mode 100644 index 00000000..ffb07063 --- /dev/null +++ b/src/price-formatter.ts @@ -0,0 +1,7 @@ +const priceFormatter = new Intl.NumberFormat('en-GB', { + currency: 'GBP', + maximumSignificantDigits: 2, + style: 'currency', +}); + +export default priceFormatter;