Skip to content

Commit ca2db99

Browse files
committed
update
1 parent 0c26a94 commit ca2db99

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

React_Learning/17_Calculator/src/App.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React from 'react';
22
import Numeric from './components/Numeric';
33
import Operators from './components/Operators';
4+
import Display from './components/Display';
45

56
function App() {
67
return (
7-
<div className="w-full h-80 flex justify-center items-center">
8-
<div className="border p-5 w-60 ">
9-
<div className="border p-2 my-5">Display</div>
10-
<div className="flex">
8+
<div className="w-full h-80 mt-10 flex justify-center items-center">
9+
<div className="border p-5 w-60 bg-slate-50">
10+
<Display />
11+
<div className="flex gap-1">
1112
<Numeric />
1213
<Operators />
1314
</div>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
function Display() {
4+
return (
5+
<>
6+
<div className="border p-2 my-5 bg-white">Display</div>
7+
</>
8+
);
9+
}
10+
11+
export default Display;

React_Learning/17_Calculator/src/components/Numeric.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import React from 'react';
22

33
function Numeric() {
4-
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 'C', '0', '='];
4+
const numbers = [7, 8, 9, 4, 5, 6, 1, 2, 3, 'C', '0', '.'];
5+
56
return (
67
<>
78
<div className="grid grid-cols-3 gap-1">
89
{numbers.map((n, id) => (
910
<button
1011
className="border px-4 py-2 rounded-xl bg-slate-400 active:bg-blue-900"
11-
key={id}>
12+
key={id}
13+
>
1214
{n}
1315
</button>
1416
))}

React_Learning/17_Calculator/src/components/Operators.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22

33
function Operators() {
4-
const operators = ['/', 'x', '-', '+'];
4+
const operators = ['/', 'x', '-', '+', '='];
55
return (
66
<>
77
<div className="grid grid-cols-1 gap-1">

0 commit comments

Comments
 (0)