-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Денис Путнов
authored and
Денис Путнов
committed
May 31, 2021
0 parents
commit 2ee3c03
Showing
41 changed files
with
12,827 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Tablet Cashbox React Ui | ||
Hi. I was create this projiect in the one of boring nights as a practice of my React, Redux etc skills. For me it's just a practice, by which i can improve my skills. | ||
|
||
In this project you can find Browser Cashbox, which can help you to oranize you business with just one tablet. So, in the screen you can see two main areas: <br/> | ||
* Cart on the right side of screen | ||
* List of items of your business with groups (folders) etc | ||
|
||
Alse at the top of the screen you can see small navigation bar. Now it has not any functionality, but I wanna improve it in the case, where this UI will be useful for many people (or it will be one else boring night). | ||
|
||
As you can see, it's not a serious project. That's why I can't sell it or somethink else, I don't know. And that's why I can afford informal description. | ||
|
||
### Usage | ||
You can start the project using command in your command line: | ||
``` | ||
yarn start | ||
``` | ||
I used `yarn` packet manager. If you want to start this project via `npm` just Google how you can do it. | ||
|
||
### How does it look like? | ||
[firstPicture]: https://ibb.co/4ZzTmbC | ||
[secondPicture]: https://ibb.co/88NWnvV | ||
[thirdPicture]: https://ibb.co/4jVS6C7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "tablet-cashbox-react-ui", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"@testing-library/jest-dom": "^5.11.4", | ||
"@testing-library/react": "^11.1.0", | ||
"@testing-library/user-event": "^12.1.10", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"react-redux": "^7.2.4", | ||
"react-router-dom": "^5.2.0", | ||
"react-scripts": "4.0.3", | ||
"redux": "^4.1.0", | ||
"web-vitals": "^1.0.1" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test", | ||
"eject": "react-scripts eject" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"react-app", | ||
"react-app/jest" | ||
] | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<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" /> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<title>React App</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react' | ||
import CashBox from './components/Cashbox/CashBox'; | ||
import NavigationBar from './components/NavigationBar/NavigationBar'; | ||
// import { createStore, compose } from "redux"; | ||
// import { Provider } from "react-redux"; | ||
// import rootReducer from "./redux/reducers/rootReducer"; | ||
|
||
// const composeEnhancers = | ||
// typeof window === "object" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ | ||
// ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) | ||
// : compose; | ||
|
||
// const store = createStore(rootReducer, composeEnhancers()); | ||
|
||
const App = () => ( | ||
<> | ||
<NavigationBar /> | ||
<CashBox /> | ||
</> | ||
) | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React, { useState, useRef, useEffect } from 'react' | ||
import classes from './CartItem.module.css' | ||
|
||
const CartItem = ({name, count, price, onDelete, onInc, onDec}) => { | ||
const [showConrollsPanel, setShowConrollsPanel] = useState(false); | ||
|
||
const cartItem = useRef(null) | ||
|
||
const openConrollsPanel = () => { | ||
setShowConrollsPanel(true) | ||
} | ||
|
||
const closeControllsPanel = () => { | ||
setShowConrollsPanel(false) | ||
} | ||
|
||
const incrementItem = () => { | ||
onInc(name) | ||
closeControllsPanel() | ||
} | ||
|
||
const decrementItem = () => { | ||
onDec(name) | ||
closeControllsPanel() | ||
} | ||
|
||
const deleteItem = () => { | ||
onDelete(name) | ||
closeControllsPanel() | ||
}; | ||
|
||
|
||
useEffect(() => { | ||
const current = cartItem.current | ||
|
||
const onBlur = (e) => { | ||
setTimeout(() => { | ||
setShowConrollsPanel(false); | ||
}, 100); | ||
} | ||
|
||
current.addEventListener('blur', onBlur) | ||
return () => { | ||
current.removeEventListener('blur', onBlur) | ||
} | ||
}, []) | ||
|
||
return ( | ||
<div className={classes.CartItem} > | ||
{ showConrollsPanel && | ||
<div className={classes.ItemControls}> | ||
<button className={classes.Delete} onClick={deleteItem} /> | ||
<button className={classes.Decrement} onClick={decrementItem} /> | ||
<button className={classes.Increment} onClick={incrementItem} /> | ||
<button className={classes.Close} onClick={closeControllsPanel}>Закрыть</button> | ||
</div> } | ||
<div ref={cartItem} tabIndex="0" className={classes.ItemInfo} onClick={openConrollsPanel}> | ||
<div> | ||
<span className={classes.ItemName}>{name}</span> | ||
<span className={classes.ItemPrice}>{price} руб.</span> | ||
</div> | ||
<div> | ||
<span className={classes.Sum}>{(price * count).toFixed(2)} руб.</span> | ||
<span className={classes.Count}>{count} шт.</span> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default CartItem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
.CartItem { | ||
position: relative; | ||
border: 2px solid #e6e6e6; | ||
border-radius: 10px; | ||
height: 80px; | ||
overflow: hidden; | ||
margin: 20px 0; | ||
box-shadow: 0 5px 15px 5px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.CartItem:first-child { | ||
margin-top: 0; | ||
} | ||
.CartItem:last-child { | ||
margin-bottom: 0; | ||
} | ||
|
||
.ItemControls { | ||
position: absolute; | ||
display: grid; | ||
grid-template-rows: 1fr; | ||
grid-template-columns: 2fr 2fr 2fr 5fr; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
z-index: 1000; | ||
backdrop-filter: blur(2px); | ||
opacity: 0.9; | ||
border-radius: 8px; | ||
background-color: #e6e6e6; | ||
} | ||
.Decrement, | ||
.Delete, | ||
.Increment, | ||
.Close { | ||
display: block; | ||
position: relative; | ||
width: 100%; | ||
border: none; | ||
background-color: transparent; | ||
} | ||
|
||
.Decrement::after, | ||
.Increment::after, | ||
.Delete::after { | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
opacity: 0.4; | ||
} | ||
|
||
.Decrement { | ||
background-image: linear-gradient(-135deg, #ffc579 0%, #ffae43 100%); | ||
} | ||
|
||
|
||
.Decrement::after { | ||
background: no-repeat center url(./minus.svg); | ||
background-size: 80% 80%; | ||
} | ||
|
||
.Delete { | ||
background-image: linear-gradient(-135deg, #ff4949 0%, #ca332e 100%); | ||
} | ||
.Delete::after { | ||
background: no-repeat center url(./delete.svg); | ||
background-size: 80% 80%; | ||
} | ||
|
||
.Increment { | ||
background-image: linear-gradient(-135deg, #a3ff47 0%, rgb(106, 209, 32) 100%); | ||
border-top-right-radius: 10px; | ||
border-bottom-right-radius: 10px; | ||
} | ||
|
||
.Increment::after { | ||
background: no-repeat center url(./plus.svg); | ||
background-size: 80% 80%; | ||
} | ||
|
||
.Close { | ||
font-size: calc(12px + 0.8vw); | ||
font-weight: bold; | ||
} | ||
|
||
.ItemInfo { | ||
position: absolute; | ||
display: grid; | ||
justify-content: space-between; | ||
grid-template-columns: 2fr 2fr; | ||
width: 100%; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
padding: 10px; | ||
background: white; | ||
border: none; | ||
align-items: unset; | ||
text-align: unset; | ||
/* max-width: 60%; */ | ||
} | ||
.ItemInfo div { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
/* max-width: 60%; */ | ||
} | ||
|
||
.ItemName { | ||
display: -webkit-box; | ||
width: 100%; | ||
font-size: calc(10px + 0.6vw); | ||
word-wrap: break-word; | ||
-webkit-line-clamp: 2; | ||
-webkit-box-orient: vertical; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.ItemPrice { | ||
font-size: calc(8px + 0.6vw); | ||
} | ||
|
||
.Sum { | ||
font-weight: bold; | ||
align-self: flex-end; | ||
font-size: calc(8px + 0.6vw); | ||
} | ||
|
||
.Count { | ||
align-self: flex-end; | ||
font-size: calc(6px + 0.8vw); | ||
} |
Oops, something went wrong.