add Statistics screen mock

This commit is contained in:
Stanislaw-Golebiewski 2019-12-22 18:35:19 +01:00
parent 5d8fcb7293
commit 1ebbf6573b
6 changed files with 82 additions and 55 deletions

View File

@ -8,9 +8,7 @@ import {
useParams useParams
} from "react-router-dom"; } from "react-router-dom";
import { Home, Login, AddReceipt } from "./screens"; import { Home, Login, AddReceipt, Statistics } from "./screens";
// import logo from "./img/logo_project.svg";
// import "./App.css";
import SimpleReactFileUpload from "./react-file-upload.js"; import SimpleReactFileUpload from "./react-file-upload.js";
function App() { function App() {
@ -20,6 +18,9 @@ function App() {
<Route path="/add_receipt"> <Route path="/add_receipt">
<AddReceipt /> <AddReceipt />
</Route> </Route>
<Route path="/home/statistics">
<Statistics />
</Route>
<Route path="/debug"> <Route path="/debug">
<SimpleReactFileUpload /> <SimpleReactFileUpload />
</Route> </Route>
@ -34,35 +35,4 @@ function App() {
); );
} }
// class Form extends React.Component {
// constructor(props) {
// super(props);
// this.state = { username: "" };
// this.handleChange = this.handleChange.bind(this);
// this.handleSubmit = this.handleSubmit.bind(this);
// }
// handleChange(event) {
// this.setState({ value: event.target.value });
// }
// handleSubmit(event) {
// alert(this.state.username);
// event.preventDefault();
// }
// render() {
// return (
// <form onSubmit={this.handleSubmit}>
// <input
// type="text"
// value={this.state.username}
// onChange={this.handleChange}
// />
// <input type="submit" value="Submit" />
// </form>
// );
// }
// }
export default App; export default App;

View File

@ -1,20 +1,40 @@
import React from "react"; import React from "react";
import { Button, Container, Grid, Icon } from "semantic-ui-react"; import { Button, Container, Grid, Icon } from "semantic-ui-react";
import { useHistory } from "react-router-dom";
import "./Home.css"; import "./Home.css";
function Home() { function Home() {
const history = useHistory();
return ( return (
<Container className="home-container"> <Container className="home-container">
<Button fluid icon size="massive" className="home-button-wrapper"> <Button
fluid
icon
size="massive"
className="home-button-wrapper"
onClick={() => history.push("/home/statistics")}
>
<Icon name="pie chart" className="home-button-icon" /> <Icon name="pie chart" className="home-button-icon" />
Statystyki Statystyki
</Button> </Button>
<Button fluid icon size="massive" className="home-button-wrapper"> <Button
fluid
icon
size="massive"
className="home-button-wrapper"
onClick={() => history.push("/home/statistics")}
>
<Icon name="shop" /> <Icon name="shop" />
Zakupy Zakupy
</Button> </Button>
<Button fluid icon size="massive" className="home-button-wrapper"> <Button
fluid
icon
size="massive"
className="home-button-wrapper"
onClick={() => history.push("/home/statistics")}
>
<Icon name="add circle" /> <Icon name="add circle" />
Dodaj paragon Dodaj paragon
</Button> </Button>

View File

@ -1,17 +0,0 @@
import React from "react";
import { Button } from "semantic-ui-react";
import "./styles.css";
function Home() {
return (
<div class="home">
<h2>Home</h2>
<Button>Statystyki</Button>
<Button>Zakupy</Button>
<Button>Dodaj paragon</Button>
</div>
);
}
export default Home;

View File

@ -0,0 +1,53 @@
import React, { Component, useState } from "react";
import {
Container,
Header,
Icon,
Image,
Menu,
Segment,
Sidebar
} from "semantic-ui-react";
import { useHistory } from "react-router-dom";
import "./Statistics.css";
function Statistics() {
const [visible, setVisible] = useState(false);
const history = useHistory();
return (
<Sidebar.Pushable>
<Sidebar
as={Menu}
animation="overlay"
icon="labeled"
inverted
onHide={() => setVisible(false)}
vertical
visible={visible}
width="thin"
>
<Menu.Item>Ogólne</Menu.Item>
<Menu.Item>Tagi</Menu.Item>
<Menu.Item>Produkty</Menu.Item>
<Menu.Item>Zakupy</Menu.Item>
</Sidebar>
<Sidebar.Pusher dimmed={visible}>
<Menu icon>
<Menu.Item onClick={() => history.push("/home")}>
<Icon name="arrow left" />
</Menu.Item>
<Menu.Item position="right" onClick={() => setVisible(true)}>
<Icon name="sidebar" />
</Menu.Item>
</Menu>
<Container></Container>
</Sidebar.Pusher>
</Sidebar.Pushable>
);
}
export default Statistics;

View File

@ -1,5 +1,6 @@
import Home from "./Home/Home"; import Home from "./Home/Home";
import Login from "./Login/Login"; import Login from "./Login/Login";
import AddReceipt from "./AddReceipt/AddReceipt"; import AddReceipt from "./AddReceipt/AddReceipt";
import Statistics from "./Statistics/Statistics";
export { Home, Login, AddReceipt }; export { Home, Login, AddReceipt, Statistics };