I am currently designing the homepage for a social media platform. I have around 45 dummy posts and I am looking for a way to limit the overflow in CSS so that only 5 posts are displayed at a time. Once the user reaches the bottom of those 5 posts, another 5 will be loaded onto the screen.
Below is the code snippet where I map over each post:
<div id='all-post-container' style={{position: 'absolute', top: '25%', left: '20%', backgroundColor: 'red', height: '72%', width: "54%", borderRadius: '30px', overflow: 'auto'}}>
<Grid
container
direction="column"
justifyContent="center"
alignItems="center"
spacing={45}
>
{arrayOfKeysForPost.map(key => {
return (
<Grid container item>
<div id="post-container" style={{margin: '5%', position: 'absolute', width: '90%', height: '40%', backgroundColor: 'white', borderRadius: '30px', overflow: 'auto'}}>
// Post content goes here
</div>
</Grid>
)})}
</Grid>
</div>
Here is an illustration showing how it currently looks with 45 posts... (Check the scrollbar on the right)