Skip to content

Commit 9d27e72

Browse files
committed
style profile page
1 parent b76043a commit 9d27e72

File tree

5 files changed

+58
-49
lines changed

5 files changed

+58
-49
lines changed

src/App.js

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,61 @@
11
// dependencies
2-
import React, { Component } from 'react';
3-
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
4-
import { ToastContainer } from 'react-toastify';
2+
import React, { Component } from "react";
3+
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
4+
import { ToastContainer } from "react-toastify";
55

66
// components
7-
import Dashboard from './components/Dashboard';
8-
import Home from './components/Home';
9-
import Navbar from './components/Navbar';
10-
import Register from './components/Register';
11-
import Login from './components/Login';
12-
import CategoriesList from './components/Category/CategoriesList';
13-
import PrivateRoute from './components/PrivateRoute';
14-
import Items from './components/Items';
15-
import Item from './components/Item';
16-
import NotFound from './components/NotFound';
17-
import AddItem from './components/AddItem';
18-
import UpdateItem from './components/UpdateItem';
19-
import User from './components/User';
7+
import Dashboard from "./components/Dashboard";
8+
import Home from "./components/Home";
9+
import Navbar from "./components/Navbar";
10+
import Register from "./components/Register";
11+
import Login from "./components/Login";
12+
import CategoriesList from "./components/Category/CategoriesList";
13+
import PrivateRoute from "./components/PrivateRoute";
14+
import Items from "./components/Items";
15+
import Item from "./components/Item";
16+
import NotFound from "./components/NotFound";
17+
import AddItem from "./components/AddItem";
18+
import UpdateItem from "./components/UpdateItem";
19+
import User from "./components/User";
2020

2121
// styles
22-
import './App.scss';
23-
import 'react-toastify/dist/ReactToastify.min.css';
24-
import Footer from './components/Footer';
22+
import "./App.scss";
23+
import "react-toastify/dist/ReactToastify.min.css";
24+
import Footer from "./components/Footer";
2525

2626
class App extends Component {
2727
render() {
2828
return (
2929
<Router>
3030
<Navbar />
31-
32-
<Switch>
33-
<Route exact path='/' component={Home} />
34-
<Route path='/login' component={Login} />
35-
<Route path='/register' component={Register} />
36-
<Route
37-
exact
38-
path='/category/:category_id'
39-
component={CategoriesList}
40-
/>
41-
<Route path='/items' component={Items} />
42-
<PrivateRoute exact path='/profile' component={Dashboard} />
43-
<PrivateRoute exact path='/profile/add' component={AddItem} />
44-
<Route exact path='/item/:id' component={Item} />
45-
<PrivateRoute
46-
exact
47-
path='/profile/update/:id'
48-
component={UpdateItem}
49-
/>
50-
<PrivateRoute exact path='/user/:id' component={User} />
51-
<Route path='*' component={NotFound} />
52-
</Switch>
31+
<div style={{ minHeight: "100vh" }} className="">
32+
<Switch>
33+
<Route exact path="/" component={Home} />
34+
<Route path="/login" component={Login} />
35+
<Route path="/register" component={Register} />
36+
<Route
37+
exact
38+
path="/category/:category_id"
39+
component={CategoriesList}
40+
/>
41+
<Route path="/items" component={Items} />
42+
<PrivateRoute exact path="/profile" component={Dashboard} />
43+
<PrivateRoute exact path="/profile/add" component={AddItem} />
44+
<Route exact path="/item/:id" component={Item} />
45+
<PrivateRoute
46+
exact
47+
path="/profile/update/:id"
48+
component={UpdateItem}
49+
/>
50+
<PrivateRoute exact path="/user/:id" component={User} />
51+
<Route path="*" component={NotFound} />
52+
</Switch>
53+
</div>
5354

5455
<Footer />
5556
<ToastContainer
5657
autoClose={3000}
57-
position='top-right'
58+
position="top-right"
5859
hideProgressBar={true}
5960
/>
6061
</Router>

src/components/Dashboard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ class Dashboard extends React.Component {
172172
src={userItem.image_url}
173173
alt="Item"
174174
/>
175-
<a href="#!">
175+
<Link to={`/item/${userItem.id}`}>
176176
<div className="mask rgba-white-slight" />
177-
</a>
177+
</Link>
178178
</div>
179179

180180
<div className="card-body">
@@ -190,7 +190,7 @@ class Dashboard extends React.Component {
190190
type="button"
191191
className="btn btn-block my-4 w-50"
192192
>
193-
<Link to={`/item/${userItem.id}`}>Edit</Link>
193+
<Link to={`/profile/update/${userItem.id}`}>Edit</Link>
194194
</Button>
195195

196196
<Button

src/components/Login.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ class Login extends React.Component {
4444
}
4545

4646
if (error) {
47-
toast.error(error);
47+
toast.error("Error Login In, Please Try Again");
4848
}
4949

5050
return (
51+
5152
<div className="mt-5 mb-5">
5253
<Form
5354
className="text-center border border-light p-5 w-50 text-center m-auto mb-5"
@@ -61,6 +62,7 @@ class Login extends React.Component {
6162
onChange={this.handleChange}
6263
className="form-control mb-4"
6364
placeholder="Enter Username"
65+
required
6466
/>
6567

6668
<Input
@@ -70,6 +72,7 @@ class Login extends React.Component {
7072
onChange={this.handleChange}
7173
className="form-control mb-4"
7274
placeholder="Enter Password"
75+
required
7376
/>
7477

7578
<div className="d-flex justify-content-around" />

src/components/Register.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class Register extends Component {
1818
email: "",
1919
state: "",
2020
town: "",
21-
password: ""
21+
password: "",
22+
location: ""
2223
};
2324

2425
handleChange = e => {
@@ -85,15 +86,15 @@ class Register extends Component {
8586
required
8687
/>
8788

88-
{/* <Input
89+
<Input
8990
type="text"
9091
name="location"
9192
value={this.state.location}
9293
onChange={this.handleChange}
9394
placeholder="Location"
9495
className="form-control mb-4"
9596
required
96-
/> */}
97+
/>
9798

9899
<Input
99100
type="text"

src/styles/Styles.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,10 @@ const Form = styled.form`
562562
p {
563563
font-family: "Ubuntu", sans-serif;
564564
}
565+
566+
@media (max-width: 770px) {
567+
width: 90% !important;
568+
}
565569
`;
566570

567571
const Profile = styled.div`

0 commit comments

Comments
 (0)