I'm using react-bootstrap and I would like to replicate this structure:
<div class="row">
<div class="col-lg-3"></div>
<div class="col-lg-3"></div>
<div class="col-lg-6"></div>
</div>
<div class="row">
<div class="col-lg-6"></div>
<div class="col-lg-3"></div>
<div class="col-lg-3"></div>
</div>
I've a list of articles that must be displayed within the columns above, if you look close, you can see that each row start with a different column, the first with 3 and second with 6 and so on...
So I wrote:
<Container>
{articles.map((art, i) =>
(i + 1) % 3 === 0 ? (
<Row>
{" "}
<></>
<BlogItem index={i} colNum={3} art={art} />{" "}
</Row>
) : (
<></>
)
)}
</Container>
but this create a different structure:
what I did wrong?
BlogItem
const BlogItem = ({ index, colNum, art }) => {
const intl = useIntl()
return (
<div
className={(index + 1) % colNum === 0 ? "col-lg-6" : "col-lg-3"}
key={index}
>
<Link to={`/blog/${art.slug}`}>
<Card className="card-background">
<div
className="full-background"
style={{
backgroundImage: `url(${process.env.API_URL}${art.featured_image.url})`,
}}
></div>
<Card.Body>
<div className="content-bottom">
<div className="card-category">
{Localization(art.category.name, intl.locale)}
</div>
<Card.Title>{Localization(art.name, intl.locale)}</Card.Title>
</div>
</Card.Body>
</Card>
</Link>
</div>
)
}
