06-day-format-correction

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

@ -127,6 +127,12 @@
text-align: center; text-align: center;
} }
table {
width: 50%;
align-content: center;
margin-left: 15%;
}
tr { tr {
height: 25px; height: 25px;
} }
@ -143,7 +149,8 @@
.td-value { .td-value {
width: 80px; width: 80px;
text-align: right; text-align: left;
padding-left: 5%;
} }
.div-line { .div-line {
@ -151,25 +158,6 @@
background-color: orange; 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> </style>
</head> </head>
<body> <body>

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

Loading…
Cancel
Save