Skip to content

Commit

Permalink
Proyecto inicial listo
Browse files Browse the repository at this point in the history
  • Loading branch information
Klerith committed Sep 18, 2021
1 parent cb3fa2c commit 05bfeb7
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 77 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@types/react-dom": "^17.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.3.0",
"react-scripts": "4.0.3",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1"
Expand Down Expand Up @@ -39,5 +40,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/react-router-dom": "^5.1.9"
}
}
38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

9 changes: 0 additions & 9 deletions src/App.test.tsx

This file was deleted.

23 changes: 4 additions & 19 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import { Navigation } from './routes/Navigation';

function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
<>
<Navigation />
</>
);
}

Expand Down
42 changes: 41 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
body {
html,body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
background-color: #282c34;
color: white;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
Expand All @@ -11,3 +13,41 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}


.main-layout {
display: flex;
flex-direction: row;
}

nav {
background-color: #363a45;
height: 100vh;
margin-right: 15px;
overflow-y: scroll;
text-align: center;
width: 250px;
}
nav ul {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
padding-left: 0;
}

nav li {
list-style: none;
margin-bottom: 10px;
}

nav li a {
color: white;
font-size: 1.2rem;
text-decoration: none;
}

.nav-active {
color: grey;
transition: all .3s ease-out;
}
45 changes: 45 additions & 0 deletions src/routes/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {
BrowserRouter as Router,
Switch,
Route,
NavLink
} from 'react-router-dom';

import logo from '../logo.svg';

export const Navigation = () => {
return (
<Router>
<div className="main-layout">
<nav>
<img src={ logo } alt="React Logo" />
<ul>
<li>
<NavLink to="/" activeClassName="nav-active" exact>Home</NavLink>
</li>
<li>
<NavLink to="/about" activeClassName="nav-active" exact>About</NavLink>
</li>
<li>
<NavLink to="/users" activeClassName="nav-active" exact>Users</NavLink>
</li>
</ul>
</nav>

{/* A <Switch> looks through its children <Route>s and
renders the first one that matches the current URL. */}
<Switch>
<Route path="/about">
<h1>About</h1>
</Route>
<Route path="/users">
<h1>Users</h1>
</Route>
<Route path="/">
<h1>Home</h1>
</Route>
</Switch>
</div>
</Router>
);
}
Loading

0 comments on commit 05bfeb7

Please sign in to comment.