Compare commits
No commits in common. "d6a2fd55abcffe0694ebbb46bd4d1d1c6cba1ab4" and "b6dd764c87f9d1f5a523849d291be7e5254b0fa3" have entirely different histories.
d6a2fd55ab
...
b6dd764c87
35
CLAUDE.md
Normal file
35
CLAUDE.md
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Simple Calculator
|
||||||
|
|
||||||
|
Greenfield project. Implementation is driven by the Vexa AI-SDLC pipeline (Jira project TSC).
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
/
|
||||||
|
├── index.html # Calculator UI (semantic HTML5)
|
||||||
|
├── styles.css # Responsive CSS layout and styling
|
||||||
|
├── README.md # Project overview
|
||||||
|
└── CLAUDE.md # This file
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build Commands
|
||||||
|
|
||||||
|
No build system has been configured yet. Update this section once a language/framework is chosen and dependencies are added.
|
||||||
|
|
||||||
|
## Test Commands
|
||||||
|
|
||||||
|
No test suite has been configured yet. Update this section once testing infrastructure is in place.
|
||||||
|
|
||||||
|
## Development Commands
|
||||||
|
|
||||||
|
No dev server or REPL is configured yet. Update this section once the implementation begins.
|
||||||
|
|
||||||
|
## Architecture Notes
|
||||||
|
|
||||||
|
- **Domain**: Simple Calculator — arithmetic operations (add, subtract, multiply, divide at minimum).
|
||||||
|
- **Stack**: Plain HTML/CSS/JS — no framework or build step.
|
||||||
|
- `index.html` contains the full UI structure: operand inputs, operation buttons, calculate/clear buttons, result `<output>`, and an error `<p role="alert">`.
|
||||||
|
|
||||||
|
## Code Style
|
||||||
|
|
||||||
|
No linter or formatter has been configured yet. Update this section once tooling is set up.
|
||||||
@ -1,2 +1,3 @@
|
|||||||
# test-simple-calculator
|
# Simple Calculator
|
||||||
|
|
||||||
|
Greenfield project. Implementation is driven by the Vexa AI-SDLC pipeline (Jira project TSC).
|
||||||
|
|||||||
55
index.html
Normal file
55
index.html
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Simple Calculator</title>
|
||||||
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<h1>Simple Calculator</h1>
|
||||||
|
|
||||||
|
<form id="calculator-form" novalidate>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Operands</legend>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="operand1">First Number</label>
|
||||||
|
<input type="number" id="operand1" name="operand1" step="any" required aria-required="true" autocomplete="off">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="operand2">Second Number</label>
|
||||||
|
<input type="number" id="operand2" name="operand2" step="any" required aria-required="true" autocomplete="off">
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Operation</legend>
|
||||||
|
|
||||||
|
<div role="group" aria-label="Select operation">
|
||||||
|
<button type="button" name="operation" value="add" aria-pressed="false">Add (+)</button>
|
||||||
|
<button type="button" name="operation" value="subtract" aria-pressed="false">Subtract (−)</button>
|
||||||
|
<button type="button" name="operation" value="multiply" aria-pressed="false">Multiply (×)</button>
|
||||||
|
<button type="button" name="operation" value="divide" aria-pressed="false">Divide (÷)</button>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button type="submit" id="calculate-btn">Calculate</button>
|
||||||
|
<button type="reset" id="clear-btn">Clear</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<section aria-live="polite" aria-atomic="true">
|
||||||
|
<h2>Result</h2>
|
||||||
|
<output id="result" for="operand1 operand2" aria-label="Calculation result"></output>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section aria-live="assertive" aria-atomic="true">
|
||||||
|
<p id="error-message" role="alert" aria-label="Error message"></p>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
266
styles.css
Normal file
266
styles.css
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
/* ===== Reset & Base ===== */
|
||||||
|
*, *::before, *::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: system-ui, -apple-system, sans-serif;
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: #1a1a1a;
|
||||||
|
background-color: #f0f2f5;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Main container ===== */
|
||||||
|
main {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
||||||
|
padding: 1.5rem;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 480px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Typography hierarchy ===== */
|
||||||
|
h1 {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1a1a1a;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 1.125rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1a1a1a;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Form ===== */
|
||||||
|
#calculator-form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
border: 1px solid #d0d0d0;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1a1a1a;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset > div + div {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Labels & Inputs ===== */
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #1a1a1a;
|
||||||
|
margin-bottom: 0.375rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="number"] {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 44px;
|
||||||
|
padding: 0.625rem 0.75rem;
|
||||||
|
border: 2px solid #767676;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #1a1a1a;
|
||||||
|
background: #ffffff;
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
appearance: textfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="number"]::-webkit-inner-spin-button,
|
||||||
|
input[type="number"]::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="number"]:focus {
|
||||||
|
outline: 3px solid #1565c0;
|
||||||
|
outline-offset: 1px;
|
||||||
|
border-color: #1565c0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Operation buttons ===== */
|
||||||
|
[role="group"] {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
button[name="operation"] {
|
||||||
|
min-height: 44px;
|
||||||
|
min-width: 44px;
|
||||||
|
padding: 0.625rem 0.5rem;
|
||||||
|
border: 2px solid #767676;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #f5f5f5;
|
||||||
|
color: #1a1a1a;
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.15s, border-color 0.15s, color 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
button[name="operation"]:hover {
|
||||||
|
background: #e0e0e0;
|
||||||
|
border-color: #1565c0;
|
||||||
|
}
|
||||||
|
|
||||||
|
button[name="operation"][aria-pressed="true"] {
|
||||||
|
background: #1565c0;
|
||||||
|
border-color: #1565c0;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
button[name="operation"]:focus-visible {
|
||||||
|
outline: 3px solid #1565c0;
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Action buttons (Calculate / Clear) ===== */
|
||||||
|
#calculator-form > div {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#calculate-btn,
|
||||||
|
#clear-btn {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 44px;
|
||||||
|
min-width: 44px;
|
||||||
|
padding: 0.625rem 1rem;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#calculate-btn {
|
||||||
|
background: #1565c0;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#calculate-btn:hover {
|
||||||
|
background: #0d47a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#clear-btn {
|
||||||
|
background: #f5f5f5;
|
||||||
|
color: #1a1a1a;
|
||||||
|
border-color: #767676;
|
||||||
|
}
|
||||||
|
|
||||||
|
#clear-btn:hover {
|
||||||
|
background: #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#calculate-btn:focus-visible,
|
||||||
|
#clear-btn:focus-visible {
|
||||||
|
outline: 3px solid #1565c0;
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Result section ===== */
|
||||||
|
section:first-of-type {
|
||||||
|
border: 1px solid #d0d0d0;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 1rem;
|
||||||
|
background: #f8f9fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
#result {
|
||||||
|
display: block;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1a1a1a;
|
||||||
|
min-height: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Error section ===== */
|
||||||
|
#error-message {
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #c62828;
|
||||||
|
min-height: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Tablet (768px+) ===== */
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
body {
|
||||||
|
padding: 2rem;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
padding: 2rem;
|
||||||
|
gap: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset > div {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset > div + div {
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset > div label {
|
||||||
|
flex: 0 0 140px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset > div input {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
[role="group"] {
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Desktop (1024px+) ===== */
|
||||||
|
@media (min-width: 1024px) {
|
||||||
|
main {
|
||||||
|
max-width: 560px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#result {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user