Compare commits
3 Commits
v0.2.3
...
a3484f4525
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3484f4525 | ||
|
|
876ef28221 | ||
|
|
e6231f86b4 |
@@ -23,5 +23,6 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
"enterfront.api": "/api",
|
"enterfront.api": "/api",
|
||||||
|
// paste stand URL to config
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "enterfront",
|
"name": "enterfront",
|
||||||
"version": "0.2.3",
|
"version": "0.2.4",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "enterfront",
|
"name": "enterfront",
|
||||||
"version": "0.2.3",
|
"version": "0.2.4",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@brojs/cli": "^1.0.0",
|
"@brojs/cli": "^1.0.0",
|
||||||
"@brojs/create": "^1.0.0",
|
"@brojs/create": "^1.0.0",
|
||||||
|
|||||||
@@ -24,5 +24,5 @@
|
|||||||
"clean": "rimraf dist"
|
"clean": "rimraf dist"
|
||||||
},
|
},
|
||||||
"name": "enterfront",
|
"name": "enterfront",
|
||||||
"version": "0.2.3"
|
"version": "0.2.4"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,14 @@ import { BrowserRouter } from 'react-router-dom';
|
|||||||
|
|
||||||
import { Dashboard } from './dashboard';
|
import { Dashboard } from './dashboard';
|
||||||
|
|
||||||
|
import { getConfigValue } from "@brojs/cli";
|
||||||
|
|
||||||
import './index.css'
|
import './index.css'
|
||||||
|
|
||||||
|
const BASE_API_URL = getConfigValue("enterfront.api");
|
||||||
|
|
||||||
|
// fetch(`${BASE_API_URL}/books/list`)
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
return(
|
return(
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
|
|||||||
17
src/components/account/AccountButtons.jsx
Normal file
17
src/components/account/AccountButtons.jsx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { URLs } from "../../__data__/urls";
|
||||||
|
import ActionButton from "./ActionButton.jsx";
|
||||||
|
|
||||||
|
const AccountButtons = (props) => {
|
||||||
|
return (
|
||||||
|
<div className="account-buttons">
|
||||||
|
<ActionButton title={"Exit"} action={props.exitHandler}/>
|
||||||
|
<ActionButton title={"Change Name"} action={props.changeNameHandler}/>
|
||||||
|
<ActionButton title={"Change Pass"} action={props.changePassHandler}/>
|
||||||
|
|
||||||
|
<a className="MyButton mclaren-regular" href={URLs.home.url}>Back</a>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AccountButtons;
|
||||||
11
src/components/account/ActionButton.jsx
Normal file
11
src/components/account/ActionButton.jsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const ActionButton = (props) => {
|
||||||
|
return (
|
||||||
|
<a className="MyButton mclaren-regular" onClick={() => {
|
||||||
|
props.action()
|
||||||
|
}}>{props.title}</a>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ActionButton;
|
||||||
29
src/components/account/index.css
Normal file
29
src/components/account/index.css
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
.account-buttons {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-buttons a {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
font-size: 1.5vw;
|
||||||
|
transition: color 0.2s ease-in;
|
||||||
|
|
||||||
|
width: 20vw;
|
||||||
|
|
||||||
|
margin-top: 2vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-buttons a:hover {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 800px) {
|
||||||
|
.account-buttons a {
|
||||||
|
font-size: 2.5vh;
|
||||||
|
width: 60vw;
|
||||||
|
margin-top: 3vh;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
@import url("reg/index.css");
|
@import url("reg/index.css");
|
||||||
@import url("init/index.css");
|
@import url("init/index.css");
|
||||||
@import url("home/index.css");
|
@import url("home/index.css");
|
||||||
|
@import url("account/index.css");
|
||||||
|
|
||||||
.MyButton {
|
.MyButton {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|||||||
@@ -1,7 +1,22 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import AccountButtons from "../components/account/AccountButtons.jsx";
|
||||||
|
import userIcon from "../../images/user.svg";
|
||||||
|
|
||||||
const Account = () => {
|
const Account = () => {
|
||||||
return <h1>Account</h1>;
|
const exitHandler = () => {}
|
||||||
|
const changeNameHandler = () => {}
|
||||||
|
const changePassHandler = () => {}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="account-items">
|
||||||
|
<img src={userIcon} alt="user" />
|
||||||
|
<AccountButtons
|
||||||
|
exitHandler={exitHandler}
|
||||||
|
changeNameHandler={changeNameHandler}
|
||||||
|
changePassHandler={changePassHandler}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Account;
|
export default Account;
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
.account-items {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
margin-top: 5vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-items img {
|
||||||
|
margin-bottom: 1vw;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
@import url("css/init.css");
|
@import url("css/init.css");
|
||||||
@import url("css/home.css");
|
@import url("css/home.css");
|
||||||
@import url("css/input.css");
|
@import url("css/input.css");
|
||||||
|
@import url("css/account.css");
|
||||||
6
stubs/api/books/book-list.json
Normal file
6
stubs/api/books/book-list.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"content": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"totalElement": 0
|
||||||
|
}
|
||||||
5
stubs/api/books/book.json
Normal file
5
stubs/api/books/book.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"name": "Book name",
|
||||||
|
"description": "Interesting book description"
|
||||||
|
}
|
||||||
36
stubs/api/books/index.js
Normal file
36
stubs/api/books/index.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
const booksRouter = require('express').Router();
|
||||||
|
|
||||||
|
module.exports = booksRouter;
|
||||||
|
|
||||||
|
const books = []
|
||||||
|
|
||||||
|
booksRouter.get('/list', (req, res) => {
|
||||||
|
res.send(require('./book-list.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
booksRouter.post('/', (req, res) => {
|
||||||
|
// body() can be used because of dev server
|
||||||
|
console.log(req.body)
|
||||||
|
books.push({
|
||||||
|
name: req.body.name,
|
||||||
|
})
|
||||||
|
|
||||||
|
res.send({
|
||||||
|
status: 200
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
booksRouter.get('/:id', (req, res) => {
|
||||||
|
console.log(req.params);
|
||||||
|
|
||||||
|
res.send(require('./book.json'));
|
||||||
|
|
||||||
|
// res.status(404).send()
|
||||||
|
})
|
||||||
|
|
||||||
|
booksRouter.delete('/:id', (req, res) => {
|
||||||
|
res.status(201).send({
|
||||||
|
status: 'ok'
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
const booksRouter = require("./books");
|
||||||
const router = require('express').Router();
|
const router = require('express').Router();
|
||||||
|
const delay = require('./middlewares/delay');
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
||||||
|
// router.use(delay(300));
|
||||||
|
router.use('/books', delay, booksRouter);
|
||||||
|
|||||||
5
stubs/api/middlewares/delay.js
Normal file
5
stubs/api/middlewares/delay.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
const delay = (ms = 1000) => (req, res, next) => {
|
||||||
|
setTimeout(next, ms)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = delay
|
||||||
Reference in New Issue
Block a user