Skip to content

Commit d8ecaef

Browse files
Merge pull request 4GeeksAcademy#90 from dsilva06/01.3-building-a-layout
01.3 building a layout
2 parents da5b029 + 214a5dc commit d8ecaef

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

exercises/01.3-building-a-layout/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tutorial: "https://www.youtube.com/watch?v=5Z12IWd4CI8"
66

77
Let's practice a little bit more about using JSX for creating HTML.
88

9-
Now we have another object that is just a bit more complex than the last one.
9+
Now we have another object that's a bit more complex than the last one.
1010

1111
Are you ready? 😃
1212

exercises/01.3-building-a-layout/app.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ const data = {
1212
},
1313
};
1414

15-
let content = <img src={data.image} />;
16-
15+
let content = (
16+
<img src={data.image} />
17+
);
1718
/**
1819
* define the variable 'content' here and fill it with the
1920
* needed code to render the bootstrap card
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from "react"; //Main React.js library
2+
import ReactDOM from "react-dom"; //we use ReactDOM to render into the DOM
3+
4+
const data = {
5+
image: "../../.learn/assets/Dylan.png?raw=true",
6+
cardTitle: "Bob Dylan",
7+
cardDescription:
8+
"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.",
9+
button: {
10+
url: "https://en.wikipedia.org/wiki/Bob_Dylan",
11+
label: "Go to wikipedia",
12+
},
13+
};
14+
15+
let content = (
16+
<div className="card m-5">
17+
<img alt="Card image cap" src={data.image} className="card-img-top" />
18+
<div className="card-body">
19+
<h5 className="card-title">{data.cardTitle}</h5>
20+
<p className="card-text">{data.cardDescription}</p>
21+
<a href={data.button.url} className="btn btn-primary">
22+
{data.button.label}
23+
</a>
24+
</div>
25+
</div>
26+
);
27+
/**
28+
* define the variable 'content' here and fill it with the
29+
* needed code to render the bootstrap card
30+
**/
31+
32+
ReactDOM.render(content, document.querySelector("#myDiv"));

0 commit comments

Comments
 (0)