Skip to content

Latest commit

 

History

History
31 lines (27 loc) · 1.18 KB

README.md

File metadata and controls

31 lines (27 loc) · 1.18 KB

Livewire Calculator

This is a Laravel Livewire calculator component that mimics the basic Apple OS calculator. It uses Laravel PHP with Blade templates, Tailwind CSS (no custom CSS), and Laravel Livewire (no custom JS).

Preview:

Things to try:

  • Calculate with equals: 2+3=
  • Calculate with operator: 2+3+4+5+
  • Calculate with number and operator: 3*=
  • Start another calculation: 2+3= 4+5=
  • Percent: 2%
  • Negate: 2±
  • Decimals and negatives: -2.4
  • Change operator without calculating: 2+-*/4=
  • 2+3% disregards first number
  • 2+3± negates last number
  • Edge cases:
    • Prepends 0 on decimal: 0.
    • Blocks multiple decimals
    • Blocks first inputs as operators
    • Shows error for large numbers
    • Rounds large decimals
    • Divide by zero: 2/0=

Nice to haves:

  • Code refactor and clean-up
  • Support keydown actions for all calculator buttons
  • Show error message on divide by zero
  • Pressing equals multiple times applies last operation