I've been working on customizing the appearance of a React component to resemble a horizontal bar chart. However, I'm facing difficulties aligning the center div to the left as intended.
Below is the code for my React component for each row:
import React from 'react'
const level3UnitItem = ({ item, ratio }) => {
return (
<div className='country-div' >
<div className='name-div'> <h1>{item.country}</h1></div>
<div style={{ width: `${ratio * 400}px`, backgroundColor: 'red' }} className='bar-div'>
</div>
<div className='number-div'><h1>{item.population.toLocaleString('en-US')}</h1></div>
</div>
)
}
export default level3UnitItem
Here is the corresponding CSS:
.country-div{
width: 100%;
display: flex;
justify-content: space-between;
padding: 1rem;
margin: .2px;
}
.country-div h1, h2{
font-size: small;
}
The current design appears as follows:
https://i.sstatic.net/9gDyl.png
My desired output should look like this: