Skip to content

Commit

Permalink
Added page with orders
Browse files Browse the repository at this point in the history
  • Loading branch information
ik-web committed Dec 11, 2022
1 parent 4870213 commit ba011fb
Show file tree
Hide file tree
Showing 29 changed files with 2,616 additions and 151 deletions.
1,595 changes: 1,593 additions & 2 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 18 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,28 @@
"name": "my-app",
"version": "0.1.0",
"private": true,
"homepage": "https://ik-web.github.io/obliksoft_testing",
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@mui/icons-material": "^5.10.16",
"@mui/material": "^5.10.17",
"@mui/x-data-grid": "^5.17.14",
"@reduxjs/toolkit": "^1.9.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.4",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@types/react-redux": "^7.1.24",
"formik": "^2.2.9",
"formik-mui": "^5.0.0-alpha.0",
"mui-tel-input": "^2.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.5",
"react-scripts": "5.0.1",
"typescript": "^4.9.3",
"web-vitals": "^2.1.4"
Expand All @@ -20,7 +32,9 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": [
Expand All @@ -39,5 +53,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^4.0.0"
}
}
38 changes: 11 additions & 27 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,25 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;1,300&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Test task</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

9 changes: 0 additions & 9 deletions src/App.test.tsx

This file was deleted.

41 changes: 21 additions & 20 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import Box from '@mui/material/Box';

function App() {
import OrdersTable from './components/OrdersTable/OrdersTable';
import OrdersPagination from './components/OrdersPagination/OrdersPagination';
import OrdersModal from './components/OrdersModal/OrdersModal';

const style = {
display: 'flex',
flexDirection: 'column',
width: '1200px',
height: '100vh',
margin: '0 auto',
padding: '0 3px',
};

const App: React.FC = () => {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
<Box sx={style}>
<OrdersModal />
<OrdersTable />
<OrdersPagination />
</Box>
);
}
};

export default App;
39 changes: 39 additions & 0 deletions src/components/OrdersModal/OrdersModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from "react";
import Box from "@mui/material/Box";
import Modal from "@mui/material/Modal";

import { useAppDispatch, useAppSelector } from "../../hooks/customHooks";
import { setIsModal } from "../../store/reducers/modalSlice";

const OrdersModal: React.FC = () => {
const { isModal } = useAppSelector((state) => state.modalReducer);
const dispatch = useAppDispatch();
const handleClose = () => dispatch(setIsModal());

return (
<div>
<Modal
open={isModal}
onClose={handleClose}
aria-labelledby="modal-modal-title"
aria-describedby="modal-modal-description"
>
<Box
sx={{
position: "absolute" as "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
width: "606px",
bgcolor: "background.paper",
boxShadow: "0px 4px 30px rgba(4, 20, 32, 0.1)",
borderRadius: "4px",
}}
>
</Box>
</Modal>
</div>
);
};

export default OrdersModal;
31 changes: 31 additions & 0 deletions src/components/OrdersPagination/OrdersPagination.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import { Box } from "@mui/material";

import PaginationInput from "./PaginationInput";
import PaginationButtons from "./PaginationButtons";
import { useAppSelector } from "../../hooks/customHooks";
import { selectTotalPages } from "../../store/reducers/ordersSlice";

const OrdersPagination: React.FC = () => {
const totalPages = useAppSelector(selectTotalPages);

return (
<Box
id="pagination"
sx={{
display: "flex",
alignItems: "center",
padding: "20px 12px 42px",
}}
>
{totalPages > 1 && (
<>
<PaginationButtons />
<PaginationInput />
</>
)}
</Box>
);
};

export default OrdersPagination;
Loading

0 comments on commit ba011fb

Please sign in to comment.