Back to Projects
Engineering • 2023-10-09
Calculator App
A multi-function calculator web app featuring basic operations, tip calculator, and discount calculator with dark/light theme support.
View on GitHubOverview
A clean, functional calculator web application built with vanilla TypeScript and direct DOM manipulation. The app provides three calculator modes with a toggleable dark/light theme.
Features
Calculator Modes
-
Basic Calculator
- Addition, subtraction, multiplication, division
- Standard calculator functionality
-
Tip Calculator
- Calculates tip based on total bill
- Supports splitting among multiple people
- Configurable tip percentage
-
Discount Calculator
- Calculates final price with discount
- Supports sales tax calculation
- Shows savings breakdown
Theme Support
- Dark theme (default)
- Light theme
- Toggle via menu icon
Technical Approach
Built using direct DOM manipulation with vanilla TypeScript:
- No frameworks - Pure DOM APIs for state and rendering
- TypeScript - Type-safe JavaScript development
- Vite - Fast development and building
- CSS Variables - Theme switching via CSS custom properties
Testing
Includes Vitest tests for calculator logic functions.
Usage
# Install dependencies
pnpm install
# Run development server
pnpm dev
# Build for production
pnpm build
# Run tests
pnpm test
This project demonstrates proficiency in core JavaScript/TypeScript fundamentals without relying on frontend frameworks.
Tech Stack
Languages
TypeScript
Frameworks
Vite
Tools
VitestHTML/CSS