Skip to content

Commit

Permalink
Deleted past commits
Browse files Browse the repository at this point in the history
  • Loading branch information
Jomonh committed Aug 10, 2024
0 parents commit 185ab90
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 0 deletions.
Binary file added Preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## *Linktree*

<img src="https://github.com/Jomonh/Calculator/blob/main/images/Preview.png" alt="Project Screenshot" width="500"/>

### 🔗 *Demo Site*
- Check out the live demo of this project: [Demo Site](https://jomonh.github.io/Calculator/)

### *Key Features*
- Responsiveness
- clean UI

### *Technologies Used*
- html
- css
- JavaScript

## Getting Started

To get started with this project, you have two options:

### 1. *Clone the Repository*
- Use the following link to clone the repository to your local machine:

```bash
git clone https://github.com/Jomonh/Calculator.git


- Once cloned, navigate to the project directory:

```bash
cd Calculator
### 2. *Fork the Repository*
- If you prefer, you can directly *fork* this repository.
- Click the *Fork* button at the top-right of this page.
- After forking, clone the repository from your account:
```bash
git clone https://github.com/your-username/your-forked-repository.git


### 🌟 *Don’t Forget to Star!*
- If you find this project useful, please consider giving it a star ⭐. It helps others discover it too!

### *License*
- This project is licensed under the MIT License - see the [LICENSE](https://opensource.org/license/MIT) file for details.
39 changes: 39 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Calculator App </title>
</head>
<body>
<div class="container">
<input type="text" class="display">
<div class="button">
<button class="operator opo" data-value="AC">AC</button>
<button class="operator opo" data-value="DEL">DEL</button>
<button class="operator opo" data-value="%">%</button>
<button class="operator opo" data-value="/">/</button>
<button data-value="7">7</button>
<button data-value="8">8</button>
<button data-value="9">9</button>
<button class="operator opo" data-value="*">*</button>
<button data-value="4">4</button>
<button data-value="5">5</button>
<button data-value="6">6</button>
<button class="operator opo" data-value="-">-</button>
<button data-value="1">1</button>
<button data-value="2">2</button>
<button data-value="3">3</button>
<button class="operator opo" data-value="+">+</button>
<button data-value="0">0</button>
<button data-value="00">00</button>
<button data-value=".">.</button>
<button class="operator eq" data-value="=">=</button>
</div>
</div>

<script src="script.js"></script>
</body>
</html>
21 changes: 21 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const display = document.querySelector(".display");
const buttons = document.querySelectorAll("button");
const specialChars = ["%", "*", "/", "-", "+", "="];
let output = "";
const calculate = (btnValue) => {
display.focus();
if (btnValue === "=" && output !== "") {
output = eval(output.replace("%", "/100"));
} else if (btnValue === "AC") {
output = "";
} else if (btnValue === "DEL") {
output = output.toString().slice(0, -1);
} else {
if (output === "" && specialChars.includes(btnValue)) return;
output += btnValue;
}
display.value = output;
};
buttons.forEach((button) => {
button.addEventListener("click", (e) => calculate(e.target.dataset.value));
});
77 changes: 77 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400&display=swap');

*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}

body{
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
}
.container{
position: relative;
max-width: 300px;
width: 100%;
border-radius: 20px;
padding: 10px 20px 20px;
background: #080707f2;
box-shadow: 0 5px 10px rgba(0,0,0,0.05);
outline: #333 10px solid;
}
.display{
height: 90px;
width: 100%;
outline: none;
border: solid 0.3;
text-align: right;
margin: 50px 0;
font-size: 40px;
color: #000;
pointer-events: none;
}
input{
background: #a19c9c70;
border-radius: 12px;
}
.button{
display: grid;
grid-gap: 12px;
grid-template-columns: repeat(4, 1fr);
}
.button button{
padding: 10px;
border-radius: 45px;
border: none;
font-size: 18px;
font-weight: 600;
cursor: pointer;
background: linear-gradient(#272728 , #575658);
}
.button button:hover{
transition: .5s;
background: linear-gradient(#575658 , #272728 );
}
.button button:active{
transform: scale(0.99);
}
.operator{
color: #e1e1e1;
}
button.opo{
background: linear-gradient(rgb(36, 34, 34) ,rgb(56, 55, 55));
}
button.opo:hover{
background: linear-gradient(rgb(56,55,55) ,rgb(36,34,34))
}
button.eq{
background: linear-gradient(#b06803, #a35603);
}
button.eq:hover{
background:linear-gradient(#a35603, #b06803);
}

0 comments on commit 185ab90

Please sign in to comment.