Created
November 11, 2021 20:22
-
-
Save PavlikPolivka/ead1e31c77b1ab80ae27157c212a5766 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let content; | |
if (isLoading) { | |
content = ( | |
<div className={styles.loadWrapper}> | |
<Spinner animation="border" role="status"> | |
<span className="visually-hidden">Loading...</span> | |
</Spinner> | |
</div> | |
) | |
} else { | |
//Generating posts list | |
content = ( | |
<> | |
{props.posts.map(({ id, date, title, image, description }) => ( | |
<Card className={styles.item}> | |
<Card.Img variant="top" src={image} width={360} height={215} /> | |
<Card.Body> | |
<Card.Title> | |
<Link href={`/posts/${id}`}> | |
<a> | |
{title} | |
</a> | |
</Link> | |
</Card.Title> | |
<Card.Subtitle className="mb-2 text-muted"><Date dateString={date} /></Card.Subtitle> | |
<Card.Text> | |
{description} | |
</Card.Text> | |
</Card.Body> | |
</Card> | |
))} | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment