Skip to content

Commit

Permalink
Router principal y secundario terminado
Browse files Browse the repository at this point in the history
  • Loading branch information
juancamilo11 committed Nov 7, 2021
1 parent f97b7f5 commit 674fa1f
Show file tree
Hide file tree
Showing 11 changed files with 441 additions and 59 deletions.
240 changes: 209 additions & 31 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
Expand Down
7 changes: 2 additions & 5 deletions src/HeroesApp.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from "react";
import AppRouter from "./routers/AppRouter";

const HeroesApp = () => {
return (
<div>
<h1>HeroesApp</h1>
</div>
);
return <AppRouter />;
};

export default HeroesApp;
47 changes: 47 additions & 0 deletions src/components/ui/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react";
import { Link, NavLink } from "react-router-dom";

export const Navbar = () => {
return (
<nav className="navbar navbar-expand-sm navbar-dark bg-dark">
<Link className="navbar-brand" to="/">
Asociaciones
</Link>

<div className="navbar-collapse">
<div className="navbar-nav">
<NavLink
activeClassName="active"
className="nav-item nav-link"
exact
to="/marvel"
>
Marvel
</NavLink>

<NavLink
activeClassName="active"
className="nav-item nav-link"
exact
to="/dc"
>
DC
</NavLink>
</div>
</div>

<div className="navbar-collapse collapse w-100 order-3 dual-collapse2">
<ul className="navbar-nav ml-auto">
<NavLink
activeClassName="active"
className="nav-item nav-link"
exact
to="/login"
>
Logout
</NavLink>
</ul>
</div>
</nav>
);
};
11 changes: 11 additions & 0 deletions src/pages/dc/DcScreen.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

const DcScreen = () => {
return (
<div>
<h1>DC Screen</h1>
</div>
);
};

export default DcScreen;
11 changes: 11 additions & 0 deletions src/pages/heroes/HeroeScreen.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

const HeroeScreen = () => {
return (
<div>
<h1>Hero Screen</h1>
</div>
);
};

export default HeroeScreen;
7 changes: 7 additions & 0 deletions src/pages/login/LoginScreen.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";

const LoginScreen = () => {
return <div>Login Screen</div>;
};

export default LoginScreen;
11 changes: 11 additions & 0 deletions src/pages/marvel/MarvelScreen.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

const MarvelScreen = () => {
return (
<div>
<h1>Marvel Screen</h1>
</div>
);
};

export default MarvelScreen;
19 changes: 19 additions & 0 deletions src/routers/AppRouter.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import LoginScreen from "../pages/login/LoginScreen";
import DashboardRoutes from "./DashboardRoutes";

const AppRouter = () => {
return (
<Router>
<div>
<Switch>
<Route exact path="/login" component={LoginScreen} />
<Route path="/" component={DashboardRoutes} />
</Switch>
</div>
</Router>
);
};

export default AppRouter;
24 changes: 24 additions & 0 deletions src/routers/DashboardRoutes.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from "react";
import { Switch, Redirect, Route } from "react-router-dom";
import { Navbar } from "../components/ui/Navbar";
import DcScreen from "../pages/dc/DcScreen";
import HeroeScreen from "../pages/heroes/HeroeScreen";
import MarvelScreen from "../pages/marvel/MarvelScreen";

const DashboardRoutes = () => {
return (
<>
<Navbar />
<div>
<Switch>
<Route exact path="/marvel" component={MarvelScreen} />
<Route exact path="/heroe/:heroeId" component={HeroeScreen} />
<Route exact path="/dc" component={DcScreen} />
<Redirect to="/marvel" />
</Switch>
</div>
</>
);
};

export default DashboardRoutes;
121 changes: 99 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@
"core-js-pure" "^3.0.0"
"regenerator-runtime" "^0.13.4"

"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4":
"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4":
"integrity" "sha512-BogPQ7ciE6SYAUPtlm9tWbgI9+2AgqSam6QivMgXgAT+fKbgppaj4ZX15MHeLC1PVF5sNk70huBu20XxWOs8Cg=="
"resolved" "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.18.tgz"
"version" "7.12.18"
Expand Down Expand Up @@ -5590,12 +5590,17 @@
"resolved" "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz"
"version" "1.1.0"

"history@^5.1.0":
"integrity" "sha512-zPuQgPacm2vH2xdORvGGz1wQMuHSIB56yNAy5FnLuwOwgSYyPKptJtcMm6Ev+hRGeS+GzhbmRacHzvlESbFwDg=="
"resolved" "https://registry.npmjs.org/history/-/history-5.1.0.tgz"
"version" "5.1.0"
"history@^4.9.0":
"integrity" "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew=="
"resolved" "https://registry.npmjs.org/history/-/history-4.10.1.tgz"
"version" "4.10.1"
dependencies:
"@babel/runtime" "^7.7.6"
"@babel/runtime" "^7.1.2"
"loose-envify" "^1.2.0"
"resolve-pathname" "^3.0.0"
"tiny-invariant" "^1.0.2"
"tiny-warning" "^1.0.0"
"value-equal" "^1.0.1"

"hmac-drbg@^1.0.1":
"integrity" "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE="
Expand All @@ -5606,6 +5611,13 @@
"minimalistic-assert" "^1.0.0"
"minimalistic-crypto-utils" "^1.0.1"

"hoist-non-react-statics@^3.1.0":
"integrity" "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw=="
"resolved" "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz"
"version" "3.3.2"
dependencies:
"react-is" "^16.7.0"

"hoopy@^0.1.4":
"integrity" "sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ=="
"resolved" "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz"
Expand Down Expand Up @@ -6288,6 +6300,11 @@
"resolved" "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
"version" "1.0.0"

"isarray@0.0.1":
"integrity" "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
"resolved" "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
"version" "0.0.1"

"isexe@^2.0.0":
"integrity" "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
"resolved" "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz"
Expand Down Expand Up @@ -6609,6 +6626,7 @@
"jest-snapshot" "^26.6.2"

"jest-resolve@*":
"integrity" "sha512-tRAz2bwraHufNp+CCmAD8ciyCpXCs1NQxB5EJAmtCFy6BN81loFEGWKzYu26Y62lAJJe4X4jg36Kf+NsQyiStQ=="
"version" "26.6.0"
dependencies:
"@jest/types" "^26.6.0"
Expand Down Expand Up @@ -7179,7 +7197,7 @@
"resolved" "https://registry.npmjs.org/loglevel/-/loglevel-1.7.1.tgz"
"version" "1.7.1"

"loose-envify@^1.1.0", "loose-envify@^1.4.0":
"loose-envify@^1.1.0", "loose-envify@^1.2.0", "loose-envify@^1.3.1", "loose-envify@^1.4.0":
"integrity" "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="
"resolved" "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz"
"version" "1.4.0"
Expand Down Expand Up @@ -7404,6 +7422,14 @@
"resolved" "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz"
"version" "1.0.1"

"mini-create-react-context@^0.4.0":
"integrity" "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ=="
"resolved" "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz"
"version" "0.4.1"
dependencies:
"@babel/runtime" "^7.12.1"
"tiny-warning" "^1.0.3"

"mini-css-extract-plugin@0.11.3":
"integrity" "sha512-n9BA8LonkOkW1/zn+IbLPQmovsL0wMb9yx75fMJQZf2X1Zoec9yTZtyMePcyu19wPkmFbzZZA6fLTotpFhQsOA=="
"resolved" "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.11.3.tgz"
Expand Down Expand Up @@ -8163,6 +8189,13 @@
"resolved" "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz"
"version" "1.0.6"

"path-to-regexp@^1.7.0":
"integrity" "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA=="
"resolved" "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz"
"version" "1.8.0"
dependencies:
"isarray" "0.0.1"

"path-to-regexp@0.1.7":
"integrity" "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
"resolved" "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz"
Expand Down Expand Up @@ -9055,7 +9088,7 @@
"kleur" "^3.0.3"
"sisteransi" "^1.0.5"

"prop-types@^15.7.2":
"prop-types@^15.0.0", "prop-types@^15.6.2", "prop-types@^15.7.2":
"integrity" "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ=="
"resolved" "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz"
"version" "15.7.2"
Expand Down Expand Up @@ -9261,7 +9294,7 @@
"strip-ansi" "6.0.0"
"text-table" "0.2.0"

"react-dom@*", "react-dom@^17.0.2", "react-dom@>=16.8":
"react-dom@*", "react-dom@^17.0.2":
"integrity" "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA=="
"resolved" "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz"
"version" "17.0.2"
Expand All @@ -9275,6 +9308,16 @@
"resolved" "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz"
"version" "6.0.9"

"react-is@^16.6.0":
"integrity" "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
"resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
"version" "16.13.1"

"react-is@^16.7.0":
"integrity" "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
"resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
"version" "16.13.1"

"react-is@^16.8.1":
"integrity" "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
"resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
Expand All @@ -9290,20 +9333,34 @@
"resolved" "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz"
"version" "0.8.3"

"react-router-dom@^6.0.1":
"integrity" "sha512-fiE+PzFTrof5q8Z/+RHzuiin9/U/q5KY2adlHClwYexbY0DqJnHcC/0U9yv3Amz9em2/bcK7X8mk7+zxB+qhvg=="
"resolved" "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.0.1.tgz"
"version" "6.0.1"
"react-router-dom@^5.2.0":
"integrity" "sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA=="
"resolved" "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.0.tgz"
"version" "5.2.0"
dependencies:
"history" "^5.1.0"
"react-router" "6.0.1"

"react-router@6.0.1":
"integrity" "sha512-O3iab52icFnQaHWONZr50CcjRlf3gx8CCjPQ0YxN8xEuEklRJNgoZSeoYFYz0fLvA4cpnhc306Nd8BYgL4QZrQ=="
"resolved" "https://registry.npmjs.org/react-router/-/react-router-6.0.1.tgz"
"version" "6.0.1"
"@babel/runtime" "^7.1.2"
"history" "^4.9.0"
"loose-envify" "^1.3.1"
"prop-types" "^15.6.2"
"react-router" "5.2.0"
"tiny-invariant" "^1.0.2"
"tiny-warning" "^1.0.0"

"react-router@5.2.0":
"integrity" "sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw=="
"resolved" "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz"
"version" "5.2.0"
dependencies:
"history" "^5.1.0"
"@babel/runtime" "^7.1.2"
"history" "^4.9.0"
"hoist-non-react-statics" "^3.1.0"
"loose-envify" "^1.3.1"
"mini-create-react-context" "^0.4.0"
"path-to-regexp" "^1.7.0"
"prop-types" "^15.6.2"
"react-is" "^16.6.0"
"tiny-invariant" "^1.0.2"
"tiny-warning" "^1.0.0"

"react-scripts@4.0.3":
"integrity" "sha512-S5eO4vjUzUisvkIPB7jVsKtuH2HhWcASREYWHAQ1FP5HyCv3xgn+wpILAEWkmy+A+tTNbSZClhxjT3qz6g4L1A=="
Expand Down Expand Up @@ -9371,7 +9428,7 @@
optionalDependencies:
"fsevents" "^2.1.3"

"react@*", "react@^17.0.2", "react@>= 16", "react@>=16.8", "react@17.0.2":
"react@*", "react@^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0", "react@^17.0.2", "react@>= 16", "react@>=15", "react@17.0.2":
"integrity" "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA=="
"resolved" "https://registry.npmjs.org/react/-/react-17.0.2.tgz"
"version" "17.0.2"
Expand Down Expand Up @@ -9687,6 +9744,11 @@
"resolved" "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz"
"version" "5.0.0"

"resolve-pathname@^3.0.0":
"integrity" "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng=="
"resolved" "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz"
"version" "3.0.0"

"resolve-url-loader@^3.1.2":
"integrity" "sha512-QEb4A76c8Mi7I3xNKXlRKQSlLBwjUV/ULFMP+G7n3/7tJZ8MG5wsZ3ucxP1Jz8Vevn6fnJsxDx9cIls+utGzPQ=="
"resolved" "https://registry.npmjs.org/resolve-url-loader/-/resolve-url-loader-3.1.2.tgz"
Expand Down Expand Up @@ -10855,6 +10917,16 @@
"resolved" "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz"
"version" "0.3.0"

"tiny-invariant@^1.0.2":
"integrity" "sha512-1Uhn/aqw5C6RI4KejVeTg6mIS7IqxnLJ8Mv2tV5rTc0qWobay7pDUz6Wi392Cnc8ak1H0F2cjoRzb2/AW4+Fvg=="
"resolved" "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.2.0.tgz"
"version" "1.2.0"

"tiny-warning@^1.0.0", "tiny-warning@^1.0.3":
"integrity" "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
"resolved" "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz"
"version" "1.0.3"

"tmpl@1.0.x":
"integrity" "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE="
"resolved" "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz"
Expand Down Expand Up @@ -11284,6 +11356,11 @@
"spdx-correct" "^3.0.0"
"spdx-expression-parse" "^3.0.0"

"value-equal@^1.0.1":
"integrity" "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw=="
"resolved" "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz"
"version" "1.0.1"

"vary@~1.1.2":
"integrity" "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
"resolved" "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz"
Expand Down

0 comments on commit 674fa1f

Please sign in to comment.