-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ch9eri
committed
Jul 4, 2022
1 parent
79a535d
commit a39ed1a
Showing
13 changed files
with
9,626 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
import React from "react"; | ||
import { Route, Routes, useNavigate } from "react-router-dom"; | ||
//import Navbar from "./Navbar"; | ||
import SignUp from "./SignUp"; | ||
import Login from "./Login"; | ||
import Home from "./Home"; | ||
import Menubar from "./Menubar"; | ||
import Router from "./Router"; | ||
|
||
function App() { | ||
const App = () => { | ||
return ( | ||
<div> | ||
GotGong FrontEnd | ||
<Router /> | ||
{/* <SignUp></SignUp> */} | ||
{/* <Routes> | ||
<Route path="/" element={Menubar}> | ||
<Route path="/home" element={Home} /> | ||
<Route path="/sign-up" element={SignUp} /> | ||
<Route path="/login" element={Login} /> | ||
</Route> | ||
</Routes> */} | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from "react"; | ||
import { Link, Outlet, useNavigate } from "react-router-dom"; | ||
|
||
const Menubar = () => { | ||
const navigate = useNavigate(); | ||
const goHome = () => { | ||
navigate("/"); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<Outlet /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Menubar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React, { useState } from "react"; | ||
|
||
function Login() { | ||
const [id, setId] = useState(""); | ||
const [password, setPassword] = useState(""); | ||
|
||
const idHandler = (e) => { | ||
setId(e.target.value); | ||
}; | ||
const passwordHandler = (e) => { | ||
setPassword(e.target.value); | ||
}; | ||
|
||
const submit = (e) => { | ||
e.preventDefault(); | ||
}; | ||
|
||
return ( | ||
<> | ||
<form> | ||
<div> | ||
<input | ||
name="id" | ||
type="id" | ||
placeholder="아이디" | ||
value={id} | ||
onChange={idHandler} | ||
/> | ||
</div> | ||
<div> | ||
<input | ||
name="password" | ||
type="password" | ||
placeholder="비밀번호" | ||
value={password} | ||
onChange={passwordHandler} | ||
/> | ||
</div> | ||
</form> | ||
<div> | ||
<button name="loginButton" type="submit" onSubmit={submit}> | ||
로그인 | ||
</button> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default Login; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from "react"; | ||
import { Link, Outlet, useNavigate } from "react-router-dom"; | ||
|
||
const Menubar = () => { | ||
const navigate = useNavigate(); | ||
const goHome = () => { | ||
navigate("/"); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<ul> | ||
<li> | ||
<Link to="/home">Home</Link> | ||
</li> | ||
<li> | ||
<Link to="/login">로그인</Link> | ||
</li> | ||
<li> | ||
<Link to="/signup">회원가입</Link> | ||
</li> | ||
</ul> | ||
|
||
<Outlet /> | ||
<button onClick={goHome} type="button"> | ||
홈으로 돌아가기 | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Menubar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useState } from "react"; | ||
import { Link } from "react-router-dom"; | ||
|
||
function Navbar() { | ||
const [sign, setSign] = useState(true); | ||
const onClick = () => { | ||
setSign((prev) => !prev); | ||
}; | ||
return ( | ||
<div> | ||
<ul className="navbar"> | ||
<li> | ||
<Link to="/">홈</Link> | ||
</li> | ||
{sign ? ( | ||
<li> | ||
<Link to="/signin"> | ||
<button onClick={onClick}>로그인</button> | ||
</Link> | ||
</li> | ||
) : ( | ||
<li> | ||
<Link to="/sign_up"> | ||
<button onClick={onClick}>회원가입</button> | ||
</Link> | ||
</li> | ||
)} | ||
</ul> | ||
</div> | ||
); | ||
} | ||
|
||
export default Navbar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from "react"; | ||
import { Route, Routes, useNavigate } from "react-router-dom"; | ||
//import Navbar from "./Navbar"; | ||
import SignUp from "./SignUp"; | ||
import Login from "./Login"; | ||
import Home from "./Home"; | ||
import Menubar from "./Menubar"; | ||
|
||
const Router = () => { | ||
return ( | ||
<Routes> | ||
<Route path="/" element={<Menubar />}> | ||
<Route path="/home" element={<Home />} /> | ||
<Route path="/signup" element={<SignUp />} /> | ||
<Route path="/login" element={<Login />} /> | ||
</Route> | ||
</Routes> | ||
); | ||
}; | ||
export default Router; |
Oops, something went wrong.