├── .gitignore
├── README.md
├── image
└── calculator.jpg
├── package-lock.json
├── package.json
├── public
├── favicon.ico
├── index.html
├── logo192.png
├── logo512.png
├── manifest.json
└── robots.txt
└── src
├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── logo.svg
├── reportWebVitals.js
└── setupTests.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
4 |
5 |

6 |
7 |
8 | ## 🛠 Installation and Setup Instructions
9 |
10 | 1. Installation: `npm i or npm install`
11 |
12 | 2. In the project directory, you can run: `npm start`
13 |
14 | Runs the app in the development mode.\
15 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
16 | The page will reload if you make edits.
17 |
18 | ## Usage Instructions
19 |
20 | Open the project folder and Navigate to `/src/components/`.
21 | You will find all the components used and you can edit your information accordingly.
22 |
23 | ### Show your support
24 |
25 | Give a ⭐ if you like this website!
26 |
27 |
28 |
--------------------------------------------------------------------------------
/image/calculator.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Soburjon19/Calculator/027ae3b576870fdb27bb30ff9d07df489b3b23d6/image/calculator.jpg
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ex00",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.5",
7 | "@testing-library/react": "^13.4.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "react": "^18.2.0",
10 | "react-dom": "^18.2.0",
11 | "react-scripts": "5.0.1",
12 | "web-vitals": "^2.1.4"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test",
18 | "eject": "react-scripts eject"
19 | },
20 | "eslintConfig": {
21 | "extends": [
22 | "react-app",
23 | "react-app/jest"
24 | ]
25 | },
26 | "browserslist": {
27 | "production": [
28 | ">0.2%",
29 | "not dead",
30 | "not op_mini all"
31 | ],
32 | "development": [
33 | "last 1 chrome version",
34 | "last 1 firefox version",
35 | "last 1 safari version"
36 | ]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Soburjon19/Calculator/027ae3b576870fdb27bb30ff9d07df489b3b23d6/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | React App
28 |
29 |
30 |
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Soburjon19/Calculator/027ae3b576870fdb27bb30ff9d07df489b3b23d6/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Soburjon19/Calculator/027ae3b576870fdb27bb30ff9d07df489b3b23d6/public/logo512.png
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/App.css:
--------------------------------------------------------------------------------
1 | body{
2 | margin: 0;
3 | min-height: 100vh;
4 | display: flex;
5 | justify-content: center;
6 | align-items: center;
7 | background-image: linear-gradient(to right, #0623F9, #7A89F9);
8 | /* background-image: linear-gradient(to right, violet, indigo, green, blue, yellow, orange, red); */
9 | }
10 |
11 | * {
12 | box-sizing: border-box;
13 | }
14 | .calculator {
15 | max-width: 320px;
16 | background: #000;
17 | width: 600px;
18 | border-radius: 15px;
19 | border: 1px solid red;
20 | height: 480px;
21 | /* box-shadow: 0 5px 30px -5px rgba(0, 0, 0, 0.6); */
22 | }
23 |
24 | .calculator-buttons {
25 | display: grid;
26 | grid-gap: 15px;
27 | grid-template-columns: repeat(4, 1fr);
28 | padding: 13px;
29 | }
30 |
31 | button {
32 | min-height: 60px;
33 | font-size: 20px;
34 | font-weight: 100px;
35 | border: none;
36 | background: rgb(200, 200, 200);
37 | border-radius: 50px;
38 | cursor: pointer;
39 | }
40 |
41 | .calc-numbers {
42 | background: rgb(0, 0, 0);
43 | color: rgb(225, 222, 222);
44 | font-size: 2em;
45 | border: 0;
46 | padding: 0.3em;
47 | text-align: right;
48 | width: 100%;
49 | height: 75px;
50 | border-radius: 50px;
51 | }
52 | .span-2 {
53 | grid-column: span 2;
54 | }
55 | .span-3 {
56 | grid-column: span 3;
57 | }
58 | .clear {
59 | background-color: rgb(234, 32, 32);
60 | color: rgb(255, 255, 255);
61 | }
62 | .btn {
63 | background-color: #544C4C;
64 | color: #fff;
65 | }
66 |
67 | .orange:hover {
68 | background: #FFA940;
69 | }
70 | .btn:hover {
71 | background: #A19090;
72 | }
73 |
74 | .btn:active {
75 | background: rgb(173, 87, 87);
76 | }
77 |
78 | .orange {
79 | background-color: #FF7C00;
80 | }
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import {useState} from "react";
2 | import './App.css';
3 | function App() {
4 | const[result, setResult] = useState('');
5 |
6 | //handle click
7 | const handleClick = e => {
8 | setResult(result?.concat(e.target?.name))
9 | };
10 |
11 | //clear button
12 | const clear = () => {
13 | setResult("");
14 | };
15 |
16 | //back button
17 | const backspace = () => {
18 | setResult(result?.slice(0, -1));
19 | };
20 |
21 | //calculator
22 | const calc = () =>{
23 | try {
24 | setResult(Number(eval(result).toString()).toFixed(2));
25 | } catch (error) {
26 | setResult("inavalid format");
27 | }
28 | };
29 | return(
30 | <>
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | >
56 | )
57 | }
58 |
59 | export default App;
60 |
--------------------------------------------------------------------------------
/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render();
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals();
18 |
--------------------------------------------------------------------------------
/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------