Skip to content

Commit d40bd2c

Browse files
committed
indicaciones hans
1 parent 1166f17 commit d40bd2c

16 files changed

Lines changed: 208 additions & 80 deletions

.learn/config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"config": {
3+
"editor": {
4+
"agent": "vscode"
5+
},
6+
"autoPlay": true
7+
},
8+
"currentExercise": null
9+
}

package-lock.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assets/img/iconosw.png

1.51 KB
Loading

src/assets/img/rigo-baby.jpg

-30.6 KB
Binary file not shown.

src/components/Card.jsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export const Card = ({ imgURL, title, children }) => {
2+
return (
3+
<>
4+
<div className="card">
5+
<img src={imgURL} className="card-img-top" alt="Luke Skywalker" />
6+
<div className="card-body">
7+
<h5 className="card-title">{title}</h5>
8+
{children}
9+
<div className="d-flex gap-5">
10+
<a href="#" className="btn btn-primary me-5">
11+
Learn more
12+
</a>
13+
<a href="like" className="btn btn-primary">
14+
<i className="fa-regular fa-bookmark"></i>
15+
</a>
16+
</div>
17+
</div>
18+
</div>
19+
</>
20+
);
21+
};

src/components/Favorites.jsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const favoriteList = ["Gustavo", "kilian", "Pepito"];
2+
export const Favorites = () => {
3+
return (
4+
<>
5+
<div className="dropdown">
6+
<a
7+
className="btn btn-primary dropdown-toggle"
8+
href="#"
9+
role="button"
10+
data-bs-toggle="dropdown"
11+
aria-expanded="false"
12+
>
13+
Favorites
14+
</a>
15+
16+
<ul className="dropdown-menu">
17+
{favoriteList.map((item) => (
18+
<li>
19+
<a className="dropdown-item" href="#">
20+
{item}
21+
</a>
22+
</li>
23+
))}
24+
</ul>
25+
</div>
26+
</>
27+
);
28+
};

src/components/Navbar.jsx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
1+
import React from "react";
12
import { Link } from "react-router-dom";
3+
import starWarsLogo from "../assets/img/iconosw.png";
4+
import { Favorites } from "./Favorites";
25

3-
export const Navbar = () => {
6+
// ... el resto del componente
47

5-
return (
6-
<nav className="navbar navbar-light bg-light">
7-
<div className="container">
8-
<Link to="/">
9-
<span className="navbar-brand mb-0 h1">React Boilerplate</span>
10-
</Link>
11-
<div className="ml-auto">
12-
<Link to="/demo">
13-
<button className="btn btn-primary">Check the Context in action</button>
14-
</Link>
15-
</div>
16-
</div>
17-
</nav>
18-
);
19-
};
8+
export const Navbar = () => {
9+
return (
10+
<nav className="navbar navbar-light bg-light">
11+
<div className="container">
12+
<Link to="/">
13+
<img
14+
src={starWarsLogo}
15+
alt="Star Wars Logo"
16+
style={{ height: "100px", marginRight: "10px" }}
17+
/>
18+
</Link>
19+
<div className="ml-auto">
20+
<Link to="/demo">
21+
<Favorites />
22+
</Link>
23+
</div>
24+
</div>
25+
</nav>
26+
);
27+
};

src/index.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.card {
2+
width: 18rem;
3+
}

src/pages/Character.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const Character = () => {
2+
return <>Character</>;
3+
};

src/pages/Home.jsx

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
import rigoImageUrl from "../assets/img/rigo-baby.jpg";
21
import useGlobalReducer from "../hooks/useGlobalReducer.jsx";
2+
import { Card } from "../components/Card";
3+
import { useEffect } from "react";
4+
import { getCharacterList } from "../swapiFetch.js";
5+
6+
const MOCK_IMG_SRC =
7+
"https://lumiere-a.akamaihd.net/v1/images/luke-skywalker-main_7ffe21c7.jpeg?region=130%2C147%2C1417%2C796";
38

49
export const Home = () => {
10+
const { store, dispatch } = useGlobalReducer();
11+
12+
const updateData = async () => {
13+
const characterList = await getCharacterList();
14+
dispatch({ type: "update_character_list", payload: characterList });
15+
};
516

6-
const {store, dispatch} =useGlobalReducer()
17+
useEffect(() => {
18+
updateData();
19+
}, []);
720

8-
return (
9-
<div className="text-center mt-5">
10-
<h1>Hello Rigo!!</h1>
11-
<p>
12-
<img src={rigoImageUrl} />
13-
</p>
14-
</div>
15-
);
16-
};
21+
return (
22+
<>
23+
Home
24+
{store.characterList.map((character) => (
25+
<Card imgURL={MOCK_IMG_SRC} title={character.name}>
26+
<ul>
27+
<li>eye color: blue</li>
28+
<li>hair Color: green</li>
29+
<li>size: 6feet</li>
30+
</ul>
31+
</Card>
32+
))}
33+
</>
34+
);
35+
};

0 commit comments

Comments
 (0)