Eric Whale

Add social networking page - client side

1 // Weather broadcasting page 1 // Weather broadcasting page
2 -import { useState, useEffect } from "react"; 2 +import { useState } from "react";
3 import { Navigate } from "react-router-dom"; 3 import { Navigate } from "react-router-dom";
4 import weatherService from "./service/weather"; 4 import weatherService from "./service/weather";
5 // components 5 // components
...@@ -40,7 +40,6 @@ function App() { ...@@ -40,7 +40,6 @@ function App() {
40 <Topbar /> 40 <Topbar />
41 <div className="mainBox"> 41 <div className="mainBox">
42 <div className="weather-buttons"> 42 <div className="weather-buttons">
43 - <b>Types {"-> "} </b>
44 <button id="weather" onClick={(e) => handleData(e)}> 43 <button id="weather" onClick={(e) => handleData(e)}>
45 Weather 44 Weather
46 </button> 45 </button>
......
...@@ -8,7 +8,7 @@ import { SiThunderbird } from "react-icons/si"; ...@@ -8,7 +8,7 @@ import { SiThunderbird } from "react-icons/si";
8 function Bottombar() { 8 function Bottombar() {
9 return ( 9 return (
10 <div className="bottombar"> 10 <div className="bottombar">
11 - <NavLink to="/tell" className="bottomBtn"> 11 + <NavLink to="/tweets" className="bottomBtn">
12 <FaKiwiBird /> 12 <FaKiwiBird />
13 </NavLink> 13 </NavLink>
14 <NavLink to="/users" className="bottomBtn"> 14 <NavLink to="/users" className="bottomBtn">
......
...@@ -10,7 +10,7 @@ function Topbar() { ...@@ -10,7 +10,7 @@ function Topbar() {
10 <Link to="/" className="logo"> 10 <Link to="/" className="logo">
11 <FcHome /> 11 <FcHome />
12 </Link> 12 </Link>
13 - <div className="title">🤖 Weather Chatbot</div> 13 + <div className="title">Weather Chatbot</div>
14 <Link to="/settings" className="settings"> 14 <Link to="/settings" className="settings">
15 <AiFillSetting /> 15 <AiFillSetting />
16 </Link> 16 </Link>
......
1 +import "../styles/layout.scss";
2 +
3 +function Tweet({ writer, createdAt, text }) {
4 + return (
5 + <div className="tweetBox">
6 + <p>{text}</p>
7 + <small>
8 + <b>{writer}</b> {createdAt}
9 + </small>
10 + </div>
11 + );
12 +}
13 +
14 +export default Tweet;
...@@ -8,7 +8,7 @@ import Signup from "./routes/signup"; ...@@ -8,7 +8,7 @@ import Signup from "./routes/signup";
8 import Login from "./routes/login"; 8 import Login from "./routes/login";
9 import Users from "./routes/users"; 9 import Users from "./routes/users";
10 import Settings from "./routes/settings"; 10 import Settings from "./routes/settings";
11 -import Tweet from "./routes/tweet"; 11 +import Tweets from "./routes/tweets";
12 import NotFound from "./routes/notfound"; 12 import NotFound from "./routes/notfound";
13 // styles 13 // styles
14 import "./styles/layout.scss"; 14 import "./styles/layout.scss";
...@@ -24,7 +24,7 @@ root.render( ...@@ -24,7 +24,7 @@ root.render(
24 <Route exact path="/signup" element={<Signup />} /> 24 <Route exact path="/signup" element={<Signup />} />
25 <Route exact path="/users" element={<Users />} /> 25 <Route exact path="/users" element={<Users />} />
26 <Route exact path="/settings" element={<Settings />} /> 26 <Route exact path="/settings" element={<Settings />} />
27 - <Route exact path="/tell" element={<Tweet />} /> 27 + <Route exact path="/tweets" element={<Tweets />} />
28 <Route path="*" element={<NotFound />} /> 28 <Route path="*" element={<NotFound />} />
29 </Routes> 29 </Routes>
30 </BrowserRouter> 30 </BrowserRouter>
......
...@@ -56,7 +56,7 @@ function Settings() { ...@@ -56,7 +56,7 @@ function Settings() {
56 <form className="authForm" onSubmit={(e) => handleSubmit(e)}> 56 <form className="authForm" onSubmit={(e) => handleSubmit(e)}>
57 <label htmlFor="username"> 57 <label htmlFor="username">
58 <input 58 <input
59 - placeholder="username" 59 + placeholder="Username"
60 onChange={(e) => onChange(e)} 60 onChange={(e) => onChange(e)}
61 value={userinfo.username} 61 value={userinfo.username}
62 type="text" 62 type="text"
...@@ -65,7 +65,7 @@ function Settings() { ...@@ -65,7 +65,7 @@ function Settings() {
65 </label> 65 </label>
66 <label htmlFor="country"> 66 <label htmlFor="country">
67 <input 67 <input
68 - placeholder="Please use Alpha-2 Country Code" 68 + placeholder="Alpha-2 Country Code"
69 onChange={(e) => onChange(e)} 69 onChange={(e) => onChange(e)}
70 value={userinfo.country.toUpperCase()} 70 value={userinfo.country.toUpperCase()}
71 type="text" 71 type="text"
...@@ -74,7 +74,7 @@ function Settings() { ...@@ -74,7 +74,7 @@ function Settings() {
74 </label> 74 </label>
75 <label htmlFor="city"> 75 <label htmlFor="city">
76 <input 76 <input
77 - placeholder="City Name (lower case)" 77 + placeholder="City Name"
78 onChange={(e) => onChange(e)} 78 onChange={(e) => onChange(e)}
79 value={userinfo.city.toLowerCase()} 79 value={userinfo.city.toLowerCase()}
80 type="text" 80 type="text"
...@@ -83,7 +83,7 @@ function Settings() { ...@@ -83,7 +83,7 @@ function Settings() {
83 </label> 83 </label>
84 <label htmlFor="email"> 84 <label htmlFor="email">
85 <input 85 <input
86 - placeholder="Change email" 86 + placeholder="email"
87 onChange={(e) => onChange(e)} 87 onChange={(e) => onChange(e)}
88 value={userinfo.email} 88 value={userinfo.email}
89 type="email" 89 type="email"
......
1 -// components
2 -import Topbar from "../components/Topbar";
3 -import Bottombar from "../components/Bottombar";
4 -
5 -function Tweet() {
6 - return (
7 - <div>
8 - <Topbar />
9 -
10 - <div className="mainBox">tweet</div>
11 -
12 - <Bottombar />
13 - </div>
14 - );
15 -}
16 -
17 -export default Tweet;
1 +// components
2 +import Tweet from "../components/Tweet";
3 +import Topbar from "../components/Topbar";
4 +import Bottombar from "../components/Bottombar";
5 +
6 +function Tweets() {
7 + const posts = [
8 + {
9 + user: "tom",
10 + text: "test post",
11 + createdAt: "2022-02-11",
12 + },
13 + {
14 + user: "jasmine",
15 + text: "test post #2",
16 + createdAt: "2022-03-03",
17 + },
18 + ];
19 +
20 + return (
21 + <div>
22 + <Topbar />
23 +
24 + <div className="mainBox">
25 + <h2>Social Network</h2>
26 + <br />
27 + {posts.map((data, index) => (
28 + <Tweet
29 + key={index}
30 + writer={data.user}
31 + text={data.text}
32 + createdAt={data.createdAt}
33 + />
34 + ))}
35 + </div>
36 +
37 + <Bottombar />
38 + </div>
39 + );
40 +}
41 +
42 +export default Tweets;
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
46 text-align: right; 46 text-align: right;
47 } 47 }
48 .title { 48 .title {
49 - width: 60vw; 49 + width: 65vw;
50 } 50 }
51 } 51 }
52 .bottombar { 52 .bottombar {
......
...@@ -10,9 +10,13 @@ html { ...@@ -10,9 +10,13 @@ html {
10 .container { 10 .container {
11 display: flex; 11 display: flex;
12 flex-direction: column; 12 flex-direction: column;
13 + justify-content: center;
13 } 14 }
14 15
15 .mainBox { 16 .mainBox {
17 + display: flex;
18 + flex-direction: column;
19 + align-items: center;
16 min-height: 82vh; 20 min-height: 82vh;
17 margin-top: 13vh; 21 margin-top: 13vh;
18 padding-left: 1rem; 22 padding-left: 1rem;
...@@ -51,7 +55,7 @@ html { ...@@ -51,7 +55,7 @@ html {
51 } 55 }
52 56
53 .logoutBtn { 57 .logoutBtn {
54 - width: 20%; 58 + width: 35%;
55 border-radius: 4px; 59 border-radius: 4px;
56 background-color: red; 60 background-color: red;
57 } 61 }
...@@ -60,10 +64,13 @@ html { ...@@ -60,10 +64,13 @@ html {
60 display: flex; 64 display: flex;
61 flex-direction: row; 65 flex-direction: row;
62 button { 66 button {
63 - margin-left: 0.2rem; 67 + margin-left: 0.5rem;
64 - margin-right: 0.2rem; 68 + margin-right: 0.5rem;
65 - padding: 0.2rem; 69 + padding: 0.3rem;
66 border-radius: 6px; 70 border-radius: 6px;
71 + background-color: blueviolet;
72 + color: white;
73 + box-shadow: 4px 4px 4px 2px gray;
67 } 74 }
68 } 75 }
69 76
...@@ -74,10 +81,10 @@ html { ...@@ -74,10 +81,10 @@ html {
74 border-radius: 4px; 81 border-radius: 4px;
75 82
76 p { 83 p {
77 - font-size: 0.9rem; 84 + font-size: 1.5rem;
78 } 85 }
79 small { 86 small {
80 - font-size: 0.7rem; 87 + font-size: 1rem;
81 } 88 }
82 } 89 }
83 90
...@@ -85,3 +92,22 @@ hr { ...@@ -85,3 +92,22 @@ hr {
85 margin-top: 0.5rem; 92 margin-top: 0.5rem;
86 margin-bottom: 0.3rem; 93 margin-bottom: 0.3rem;
87 } 94 }
95 +
96 +// tweets
97 +.tweetBox {
98 + display: flex;
99 + justify-content: center;
100 + flex-direction: column;
101 + width: 60%;
102 + border: solid gray 2px;
103 + border-radius: 4px;
104 + margin-bottom: 1rem;
105 + padding: 0.2rem;
106 + small {
107 + font-size: 1.5rem;
108 + margin-top: 0.3rem;
109 + b {
110 + font-size: 1.6rem;
111 + }
112 + }
113 +}
......