Toggle navigation
Toggle navigation
This project
Loading...
Sign in
황선혁
/
weather_chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Eric Whale
2022-05-21 11:19:41 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6ea1dd8ec6c799dd03735895f9aee807452372b8
6ea1dd8e
1 parent
5c28eb86
Build basic login/signup page structure
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
24 deletions
client/src/App.js
client/src/index.js
client/src/routes/login.jsx
client/src/routes/settings.jsx
client/src/routes/signup.jsx
client/src/routes/userroom.jsx
client/src/styles/layout.scss
client/src/App.js
View file @
6ea1dd8
import
{
Outlet
,
useLocation
}
from
"react-router-dom"
;
// components
import
Bottombar
from
"./components/Bottombar"
;
import
Topbar
from
"./components/Topbar"
;
function
App
()
{
let
location
=
useLocation
();
const
renderByLocation
=
()
=>
{
if
(
location
.
pathname
!=
"/"
)
{
return
<
Outlet
/>
;
}
return
(
<
div
>
<
h1
>
chatroom
<
/h1
>
<
/div
>
);
};
return
(
<
div
>
<
Topbar
/>
{
renderByLocation
()}
<
h1
>
Chatroom
<
/h1
>
<
Bottombar
/>
<
/div
>
);
...
...
client/src/index.js
View file @
6ea1dd8
import
React
from
"react"
;
import
ReactDOM
from
"react-dom/client"
;
import
{
BrowserRouter
,
Routes
,
Route
,
Navigate
}
from
"react-router-dom"
;
import
{
BrowserRouter
,
Routes
,
Route
}
from
"react-router-dom"
;
import
reportWebVitals
from
"./reportWebVitals"
;
import
App
from
"./App"
;
// routes
...
...
@@ -14,12 +14,12 @@ const root = ReactDOM.createRoot(document.getElementById("root"));
root
.
render
(
<
BrowserRouter
>
<
Routes
>
<
Route
path
=
"/"
element
=
{
<
App
/>
}
>
<
Route
path
=
"/userroom"
element
=
{
<
Userroom
/>
}
/
>
<
Route
path
=
"/settings"
element
=
{
<
Settings
/>
}
/
>
<
/Route
>
// root route is for chatroom
<
Route
path
=
"/"
element
=
{
<
App
/>
}
/
>
<
Route
path
=
"/login"
element
=
{
<
Login
/>
}
/
>
<
Route
path
=
"/signup"
element
=
{
<
Signup
/>
}
/
>
<
Route
path
=
"/userroom"
element
=
{
<
Userroom
/>
}
/
>
<
Route
path
=
"/settings"
element
=
{
<
Settings
/>
}
/
>
<
/Routes
>
<
/BrowserRouter
>
);
...
...
client/src/routes/login.jsx
View file @
6ea1dd8
// styles
import
{
Link
}
from
"react-router-dom"
;
import
"../styles/layout.scss"
;
function
Login
()
{
const
handleSubmit
=
(
e
)
=>
{
e
.
preventDefault
();
console
.
log
(
"login form submit called"
);
};
return
(
<
div
>
<
h1
>
Login page
</
h1
>
<
div
className=
"container"
>
<
h1
>
Welcome back to Weather-Chatbot/Messanger!
</
h1
>
<
h2
>
Stay connected with weather/friends all the time
</
h2
>
<
button
>
Login with Google
</
button
>
<
button
>
Login with GitHub
</
button
>
<
br
/>
<
form
className=
"authForm"
onSubmit=
{
(
e
)
=>
handleSubmit
(
e
)
}
>
<
label
htmlFor=
"email"
>
email:
<
input
type=
"text"
id=
"email"
/>
</
label
>
<
label
htmlFor=
"password"
>
password:
<
input
type=
"text"
id=
"password"
/>
</
label
>
<
label
htmlFor=
"submit"
>
<
input
type=
"submit"
id=
"submit"
/>
</
label
>
</
form
>
<
br
/>
<
p
>
Don't have an account?
<
Link
to=
"/signup"
>
Create account
</
Link
>
</
p
>
</
div
>
);
}
...
...
client/src/routes/settings.jsx
View file @
6ea1dd8
// components
import
Bottombar
from
"../components/Bottombar"
;
import
Topbar
from
"../components/Topbar"
;
function
Settings
()
{
return
(
<>
<
Topbar
/>
<
div
>
<
h1
>
Settings page
</
h1
>
<
div
>
username
</
div
>
...
...
@@ -8,6 +14,8 @@ function Settings() {
<
br
/>
<
button
>
notification
</
button
>
</
div
>
<
Bottombar
/>
</>
);
}
...
...
client/src/routes/signup.jsx
View file @
6ea1dd8
import
{
Link
}
from
"react-router-dom"
;
// styles
import
"../styles/layout.scss"
;
function
Signup
()
{
const
handleSubmit
=
(
e
)
=>
{
e
.
preventDefault
();
console
.
log
(
"signup form submit called"
);
};
return
(
<
div
>
<
h1
>
Signup page
</
h1
>
<
div
className=
"container"
>
<
h1
>
Welcome to Weather-Chatbot/Messanger!
</
h1
>
<
h2
>
Stay connected with weather/friends all the time
</
h2
>
<
button
>
Create account with Google
</
button
>
<
button
>
Create account with GitHub
</
button
>
<
br
/>
<
form
className=
"authForm"
onSubmit=
{
(
e
)
=>
handleSubmit
(
e
)
}
>
<
label
htmlFor=
"username"
>
username:
<
input
type=
"text"
id=
"username"
/>
</
label
>
<
label
htmlFor=
"email"
>
email:
<
input
type=
"text"
id=
"email"
/>
</
label
>
<
label
htmlFor=
"password"
>
password:
<
input
type=
"text"
id=
"password"
/>
</
label
>
<
label
htmlFor=
"submit"
>
<
input
type=
"submit"
id=
"submit"
/>
</
label
>
</
form
>
<
br
/>
<
p
>
Have an account?
<
Link
to=
"/login"
>
Login
</
Link
>
</
p
>
</
div
>
);
}
...
...
client/src/routes/userroom.jsx
View file @
6ea1dd8
// components
import
Bottombar
from
"../components/Bottombar"
;
import
Topbar
from
"../components/Topbar"
;
function
Userroom
()
{
return
(
<
div
>
<
Topbar
/>
<
h1
>
Userroom page
</
h1
>
<
Bottombar
/>
</
div
>
);
}
...
...
client/src/styles/layout.scss
0 → 100644
View file @
6ea1dd8
.container
{
display
:
flex
;
flex-direction
:
column
;
}
.authForm
{
display
:
flex
;
flex-direction
:
column
;
}
Please
register
or
login
to post a comment