Let's practice a little bit more about using JSX for creating HTML.
Now we have another object that is just a bit more complex than the last one.
You have a data
object that contains Bob Dylans information (image, title, etc).
const data = {
image: "https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Bob_Dylan_-_Azkena_Rock_Festival_2010_2.jpg/800px-Bob_Dylan_-_Azkena_Rock_Festival_2010_2.jpg",
cardTitle: "Bob Dylan",
cardDescription: "Bob Dylan (born Robert Allen Zimmerman, May 24, 1941) is an American singer/songwriter, author, and artist who has been an influential figure in popular music and culture for more than five decades.",
button: {
url: "https://en.wikipedia.org/wiki/Bob_Dylan",
label: "Go to wikipedia"
}
};
Use the information contained in data
to render a bootstrap card, for example: The card's title will be the data.cardTitle
, etc.
Here is the HTML code for creating a card in bootstrap:
<div class="card m-5">
<img class="card-img-top" src="..." alt="Card image cap" />
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the cards content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
Source: Bootstrap Card