Skip to content

Commit 2e5e113

Browse files
committed
[Bug-1503] Componente Jumbotron actualizado con clases de Bosstrap 5.2
1 parent ac52822 commit 2e5e113

File tree

5 files changed

+97
-79
lines changed

5 files changed

+97
-79
lines changed

exercises/03.4-jumbotron/README.es.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1-
# `03.4` Jumbotron
1+
# `03.4` Hero Component
22

33
Usando todo lo que has aprendido...
44

55
## 📝 Instrucciones:
66

7-
1. Construye un componente `Jumbotron` que reciba las siguientes propiedades:
7+
1. Construye un componente `HeroSection` que reciba las siguientes propiedades:
88

99
```jsx
10-
<Jumbotron
11-
title="Welcome to react"
12-
description="React is the most popular rendering library in the world"
13-
buttonLabel="Go to the official website"
14-
buttonURL="https://reactjs.org/"
10+
<HeroSection
11+
title="Welcome to React!"
12+
description="React is the most popular rendering library in the world"
13+
buttonLabel="Go to the official website"
14+
buttonURL="https://reactjs.org/"
1515
/>
1616
```
1717

1818
## 💻 Resultado Esperado:
19-
20-
![Jumbotron](../../.learn/assets/03.4-1.png?raw=true)
19+
20+
![HeroSection](../../.learn/assets/03.4-1.png?raw=true)
2121

2222
## 💡 Pistas:
2323

24-
+ Recuerda usar los prop-types para validar las propiedades de tu componente.
24+
- Recuerda usar los prop-types para validar las propiedades de tu componente.
2525

26-
+ Tu componente debería generar un HTML similar a este:
26+
- Tu componente debería generar un HTML similar a este:
2727

2828
```html
29-
<div class="jumbotron m-5">
30-
<h1 class="display-4">Welcome to react</h1>
29+
<div class="bg-light p-5 m-5">
30+
<h1 class="display-4">Welcome to React!</h1>
3131
<p class="lead">React is the most popular rendering library in the world</p>
32-
<a class="btn btn-primary btn-lg" href="https://reactjs.org/" role="button">Go to the official website</a>
32+
<a class="btn btn-primary btn-lg" href="https://reactjs.org/" role="button"
33+
>Go to the official website</a
34+
>
3335
</div>
3436
```

exercises/03.4-jumbotron/README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
---
2-
tutorial: "https://www.youtube.com/watch?v=zv6HPveyz6g"
2+
tutorial: 'https://www.youtube.com/watch?v=zv6HPveyz6g'
33
---
44

5-
# `03.4` Jumbotron
5+
# `03.4` Hero Component
66

7-
Using everything you have learned so far...
7+
Using everything you have learned so far...
88

99
## 📝 Instructions:
1010

11-
1. Build a `Jumbotron` component that receives the following properties:
11+
1. Build a `HeroSection` component that receives the following properties:
1212

1313
```jsx
14-
<Jumbotron
15-
title="Welcome to react"
16-
description="React is the most popular rendering library in the world"
17-
buttonLabel="Go to the official website"
18-
buttonURL="https://reactjs.org/"
14+
<HeroSection
15+
title="Welcome to React!"
16+
description="React is the most popular rendering library in the world"
17+
buttonLabel="Go to the official website"
18+
buttonURL="https://reactjs.org/"
1919
/>
2020
```
2121

2222
## 💻 Expected result:
23-
24-
![Jumbotron](../../.learn/assets/03.4-1.png?raw=true)
23+
24+
![HeroSection](../../.learn/assets/03.4-1.png?raw=true)
2525

2626
## 💡 Hints:
2727

28-
+ Remember to use prop-types to validate your component properties.
28+
- Remember to use prop-types to validate your component properties.
2929

30-
+ Your HTML's component should be something like this:
30+
- Your HTML's component should be something like this:
3131

3232
```html
33-
<div class="jumbotron m-5">
34-
<h1 class="display-4">Welcome to react</h1>
33+
<div class="bg-light p-5 m-5">
34+
<h1 class="display-4">Welcome to React!</h1>
3535
<p class="lead">React is the most popular rendering library in the world</p>
36-
<a class="btn btn-primary btn-lg" href="https://reactjs.org/" role="button">Go to the official website</a>
36+
<a class="btn btn-primary btn-lg" href="https://reactjs.org/" role="button"
37+
>Go to the official website</a
38+
>
3739
</div>
3840
```

exercises/03.4-jumbotron/app.jsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,30 @@ import React from "react";
22
import ReactDOM from "react-dom";
33
import PropTypes from "prop-types";
44

5-
const Jumbotron = props => {
5+
const HeroSection = (props) => {
66
// Here you have to return expected html using the properties being passed to the component
7+
return (
8+
<div className="bg-light p-5 m-5">
9+
<h1 className="display-4">{props.title}</h1>
10+
<p className="lead">{props.description}</p>
11+
<a className="btn btn-primary btn-lg" href={props.buttonURL} role="button">
12+
{props.buttonLabel}
13+
</a>
14+
</div>
15+
);
716
};
817

9-
Jumbotron.propTypes = {
18+
HeroSection.propTypes = {
1019
// PropTypes here
1120
title: PropTypes.string,
12-
21+
description: PropTypes.string,
22+
buttonLabel: PropTypes.string,
23+
buttonURL: PropTypes.string,
1324
};
1425

1526
ReactDOM.render(
16-
<Jumbotron
17-
title="Welcome to react"
27+
<HeroSection
28+
title="Welcome to React!"
1829
description="React is the most popular rendering library in the world"
1930
buttonLabel="Go to the official website"
2031
buttonURL="https://reactjs.org/"
Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
1-
import React from "react";
2-
import ReactDOM from "react-dom";
3-
import PropTypes from "prop-types";
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import PropTypes from 'prop-types';
44

5-
const Jumbotron = (props) => {
6-
// Here you have to return expected html using the properties being passed to the component
7-
return (
8-
<div className="jumbotron m-5">
9-
<h1 className="display-4">{props.title}</h1>
10-
<p className="lead">{props.description}</p>
11-
<a className="btn btn-primary btn-lg" href={props.buttonURL} role="button">
12-
{props.buttonLabel}
13-
</a>
14-
</div>
15-
);
5+
const HeroSection = (props) => {
6+
// Here you have to return expected html using the properties being passed to the component
7+
return (
8+
<div className="bg-light p-5 m-5">
9+
<h1 className="display-4">{props.title}</h1>
10+
<p className="lead">{props.description}</p>
11+
<a
12+
className="btn btn-primary btn-lg"
13+
href={props.buttonURL}
14+
role="button">
15+
{props.buttonLabel}
16+
</a>
17+
</div>
18+
);
1619
};
1720

18-
Jumbotron.propTypes = {
19-
// PropTypes here
20-
title: PropTypes.string,
21-
description: PropTypes.string,
22-
buttonLabel: PropTypes.string,
23-
buttonURL: PropTypes.string
21+
HeroSection.propTypes = {
22+
// PropTypes here
23+
title: PropTypes.string,
24+
description: PropTypes.string,
25+
buttonLabel: PropTypes.string,
26+
buttonURL: PropTypes.string,
2427
};
2528

2629
ReactDOM.render(
27-
<Jumbotron
28-
title="Welcome to react"
29-
description="React is the most popular rendering library in the world"
30-
buttonLabel="Go to the official website"
31-
buttonURL="https://reactjs.org/"
32-
/>,
30+
<HeroSection
31+
title="Welcome to React!"
32+
description="React is the most popular rendering library in the world"
33+
buttonLabel="Go to the official website"
34+
buttonURL="https://reactjs.org/"
35+
/>,
3336

34-
document.querySelector("#myDiv")
37+
document.querySelector('#myDiv')
3538
);

exercises/03.4-jumbotron/tests.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
import ReactDOM from "react-dom";
2-
import { WhatToRender } from "./app.jsx";
3-
import jsxToString from "jsx-to-string";
4-
import renderer from "react-test-renderer";
1+
import ReactDOM from 'react-dom';
2+
import { WhatToRender } from './app.jsx';
3+
import jsxToString from 'jsx-to-string';
4+
import renderer from 'react-test-renderer';
55

6-
jest.mock("react-dom", () => ({ render: jest.fn() }));
6+
jest.mock('react-dom', () => ({ render: jest.fn() }));
77

8-
test("ReactDOM needs to be called once", () => {
8+
test('ReactDOM needs to be called once', () => {
99
expect(ReactDOM.render.mock.calls.length).toBe(1);
1010
});
1111

12-
test("Component title has to be passed properly", () => {
12+
test('Component title has to be passed properly', () => {
1313
const component = ReactDOM.render.mock.calls[0][0];
14-
expect(component.props.title).toBe("Welcome to react");
14+
expect(component.props.title).toBe('Welcome to React!');
1515
});
1616

17-
test("Component description has to be passed properly", () => {
17+
test('Component description has to be passed properly', () => {
1818
const component = ReactDOM.render.mock.calls[0][0];
1919
expect(component.props.description).toBe(
20-
"React is the most popular rendering library in the world"
20+
'React is the most popular rendering library in the world'
2121
);
2222
});
2323

24-
test("Component buttonLabel has to be passed properly", () => {
24+
test('Component buttonLabel has to be passed properly', () => {
2525
const component = ReactDOM.render.mock.calls[0][0];
26-
expect(component.props.buttonLabel).toBe("Go to the official website");
26+
expect(component.props.buttonLabel).toBe('Go to the official website');
2727
});
2828

29-
test("Component buttonURL has to be passed properly", () => {
29+
test('Component buttonURL has to be passed properly', () => {
3030
const component = ReactDOM.render.mock.calls[0][0];
31-
expect(component.props.buttonURL).toBe("https://reactjs.org/");
31+
expect(component.props.buttonURL).toBe('https://reactjs.org/');
3232
});
3333

34-
test("The component should return the exact HTML", () => {
34+
test('The component should return the exact HTML', () => {
3535
const tree = renderer.create(ReactDOM.render.mock.calls[0][0]).toJSON();
3636
expect(tree).toMatchInlineSnapshot(`
3737
<div
38-
className="jumbotron m-5"
38+
className="bg-light p-5 m-5"
3939
>
4040
<h1
4141
className="display-4"
4242
>
43-
Welcome to react
43+
Welcome to React!
4444
</h1>
4545
<p
4646
className="lead"

0 commit comments

Comments
 (0)