Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 65 additions & 37 deletions projects/calculator/index.html
Original file line number Diff line number Diff line change
@@ -1,48 +1,76 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculator</title>
<link rel="stylesheet" href="styles.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Premium Calculator with History</title>
<link rel="stylesheet" href="styles.css">
<script defer src="main.js"></script>
</head>

<body>
<div class="calculator">
<div class="display">
<div class="previous-operand" id="previousOperand"></div>
<div class="current-operand" id="currentOperand">0</div>
<div class="theme-toggle-container">
<button class="theme-toggle" aria-label="Toggle Theme" onclick="toggleTheme()">
<svg class="theme-icon" id="themeIcon" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</button>
</div>

<div class="buttons">
<button class="function" aria-label="All Clear" data-action="clear">AC</button>
<button class="function" aria-label="Backspace" data-action="backspace">⌫</button>
<button class="function" aria-label="Toggle Sign" data-action="toggle-sign">+/-</button>
<button class="operator" aria-label="Divide" data-action="operator" data-operator="Γ·">Γ·</button>

<button aria-label="7" data-number="7">7</button>
<button aria-label="8" data-number="8">8</button>
<button aria-label="9" data-number="9">9</button>
<button class="operator" aria-label="Multiply" data-action="operator" data-operator="Γ—">Γ—</button>

<button aria-label="4" data-number="4">4</button>
<button aria-label="5" data-number="5">5</button>
<button aria-label="6" data-number="6">6</button>
<button class="operator" aria-label="Subtract" data-action="operator" data-operator="βˆ’">βˆ’</button>

<button aria-label="1" data-number="1">1</button>
<button aria-label="2" data-number="2">2</button>
<button aria-label="3" data-number="3">3</button>
<button class="operator" aria-label="Add" data-action="operator" data-operator="+">+</button>

<button class="zero" aria-label="0" data-number="0">0</button>
<button aria-label="Decimal" data-action="decimal">.</button>
<button class="function" aria-label="Percentage" data-action="percentage">%</button>
<button class="equals" aria-label="Equals" data-action="equals">=</button>

<div class="calculator-wrapper" id="calculatorWrapper">
<div class="calculator" id="calculator">
<div class="display">
<button class="clear-history" onclick="clearHistory()" title="Clear History">Clear</button>
<div class="history-container" id="historyContainer">
<!-- History items will be added here -->
</div>
<div class="current-calculation">
<div class="previous-operand" id="previousOperand"></div>
<div class="current-operand" id="currentOperand">0</div>
</div>
</div>
<div class="buttons">
<!-- Row 1: Clear Functions -->
<button class="clear" aria-label="All Clear" data-action="clear">AC</button>
<button class="backspace" aria-label="Backspace" data-action="backspace">⌫</button>
<button class="sign-toggle" aria-label="Toggle Sign" data-action="toggle-sign">+/-</button>
<button class="operator" aria-label="Divide" data-action="operator" data-operator="Γ·">Γ·</button>

<!-- Row 2: Numbers 7-9 and Multiply -->
<button aria-label="7" data-number="7">7</button>
<button aria-label="8" data-number="8">8</button>
<button aria-label="9" data-number="9">9</button>
<button class="operator" aria-label="Multiply" data-action="operator" data-operator="Γ—">Γ—</button>

<!-- Row 3: Numbers 4-6 and Subtract -->
<button aria-label="4" data-number="4">4</button>
<button aria-label="5" data-number="5">5</button>
<button aria-label="6" data-number="6">6</button>
<button class="operator" aria-label="Subtract" data-action="operator" data-operator="βˆ’">βˆ’</button>

<!-- Row 4: Numbers 1-3 and Add -->
<button aria-label="1" data-number="1">1</button>
<button aria-label="2" data-number="2">2</button>
<button aria-label="3" data-number="3">3</button>
<button class="operator" aria-label="Add" data-action="operator" data-operator="+">+</button>

<!-- Row 5: Decimal, Zero, Percentage, Equals -->
<button aria-label="Decimal" data-action="decimal">.</button>
<button aria-label="0" data-number="0">0</button>
<button class="percentage" aria-label="Percentage" data-action="percentage">%</button>
<button class="equals" aria-label="Equals" data-action="equals">=</button>
</div>
</div>
</div>
</div>
<script src="main.js"></script>
</body>

</html>
Loading