This commit is contained in:
Joshua Hsueh 2021-01-30 17:11:55 -05:00
commit e4cebacdfe
3 changed files with 60 additions and 2 deletions

View File

@ -1,15 +1,37 @@
import React from "react";
import React, { useState } from "react";
import { BrowserRouter, Route, Switch } from "react-router-dom";
import Portfolio from "./components/Portfolio";
import Bank from "./components/Bank";
import Profile from "./components/Profile";
import Browse from "./components/Browse";
import Login from "./components/Login";
import "./App.css";
function App() {
const adminUser = {
email: "admin@admin.com",
password: "admin123"
}
const [user, setUser] = useState({name: "", email: ""});
const [error, setError] = useState("");
const Login = details => {
console.log(details);
}
const Logout = () => {
console.log("Logout");
}
return (
<BrowserRouter>
<div className="App">
<BrowserRouter>
<Switch>
<Route component={Bank} path="/banking" />
<Route component={Browse} path="/browse" />
@ -17,6 +39,16 @@ function App() {
<Route component={Portfolio} path="/" />
</Switch>
</BrowserRouter>
{(user.email !== "") ? (
<div className="welcome">
<h2>Welcome, <span>{user.name}</span></h2>
<button>Logout</button>
</div>
) : (
<Login/>
)}
</div>
);
}

View File

@ -0,0 +1,26 @@
import React from 'react';
const Login = (props) => {
return (
<form>
<div className="form-inner">
<h2>Login</h2>
<div className="form-group">
<label htmlFor="name">Name:</label>
<input type="text" name="name" id="name"/>
</div>
<div className="form-group">
<label htmlFor="email">Email: </label>
<input type="email" name="email" id="email"/>
</div>
<div className="form-group">
<label htmlFor="password">Password:</label>
<input type="password" name="password" id="password"/>
</div>
</div>
</form>
)
}
export default Login

View File