Added thousands separator

- added thousands separator to helpers and signup screen
This commit is contained in:
Peter Zimon 2021-03-08 17:24:50 +01:00
parent 5cacd0611d
commit bb59b019db
3 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import React from 'react';
import {isCookiesDisabled} from '../../utils/helpers';
import {isCookiesDisabled, formatNumber} from '../../utils/helpers';
export const PlanSectionStyles = `
.gh-portal-plans-container {
@ -255,7 +255,7 @@ function PriceLabel({currencySymbol, price}) {
return (
<div className='gh-portal-plan-pricelabel'>
<span className={currencyClass}>{currencySymbol}</span>
<span className='gh-portal-plan-price'>{price}</span>
<span className='gh-portal-plan-price'>{formatNumber(price)}</span>
</div>
);
}

View File

@ -6,8 +6,8 @@ export const site = {
accent_color: '',
url: 'http://localhost:2368/',
plans: {
monthly: 5,
yearly: 15,
monthly: 5000,
yearly: 150000,
currency: 'USD'
},
allow_self_signup: true,

View File

@ -191,6 +191,10 @@ export const getCurrencySymbol = (currency) => {
return Intl.NumberFormat('en', {currency, style: 'currency'}).format(0).replace(/[\d\s.]/g, '');
};
export const formatNumber = (amount) => {
return amount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
};
export const createPopupNotification = ({type, status, autoHide, duration, closeable, state, message, meta = {}}) => {
let count = 0;
if (state && state.popupNotification) {