06-day-format-correction

pull/331/head
Dan.Kapustin 2 years ago
parent bd20ecc198
commit eaeddebc97

@ -127,6 +127,12 @@
text-align: center;
}
table {
width: 50%;
align-content: center;
margin-left: 15%;
}
tr {
height: 25px;
}
@ -143,7 +149,8 @@
.td-value {
width: 80px;
text-align: right;
text-align: left;
padding-left: 5%;
}
.div-line {
@ -151,25 +158,6 @@
background-color: orange;
}
.graph-title {
font-size: small;
font-family: Arial;
text-align: center;
}
.graphs {
display: flex;
justify-content: center;
}
#stat {
display: flex;
justify-content: center;
}
.stat-table {
border: thin solid gray;
}
</style>
</head>
<body>

@ -58,6 +58,10 @@ const Main = ({ numbers }) => (
)
//Population
function numberWithCommas(x) {
return x.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}
const Country = ({ countries }) => {
const countryList = countries.map((country) =>
<tr className='tr'>
@ -68,7 +72,7 @@ const Country = ({ countries }) => {
</div>
</td>
<td className='td-value'>
{new Intl.NumberFormat('ru-RU').format(country.population)}
{numberWithCommas(country.population)}
</td>
</tr>
)
@ -79,7 +83,7 @@ const Country = ({ countries }) => {
const Population = ({ countries, count }) => (
<main>
<h1>{count} most populated countries in the world</h1>
<Country countries={countries} />
<table className='table'><Country countries={countries} /></table>
</main>
)

Loading…
Cancel
Save