Skip to content
Submitted over 2 years ago

Calculator (React, Styled components, TypeScript)

react, styled-components, typescript, motion
LVL 2
Lee170
@tripkmin
A solution to the Calculator app challenge

Solution retrospective


🔗 Links

🛠️ Technologies Used

  • React JS
  • TypeScript
  • Styled-Components
  • Framer Motion
  • HTML5, CSS

🗒️ Key Features

  • Implemented features similar to the Windows default calculator.
    • Integer part is separated by commas, and decimal part is displayed without separation.
  • Fully supports keyboard input.
    • 0~9: Number input
    • Enter: Display calculation result
    • Backspace: Backspace during number input, reset during result display
    • Esc: Reset
  • User-selected theme is stored in local storage.
  • After completion of calculation, the result can be copied to the clipboard by clicking.
    • Clipboard copy is not available during calculation or when there is no calculation result.
  • When copying is completed, a toast appears providing feedback.

🔴 Things I Want to Know

  • I'd like to know if there are any issues regarding accessibility.
  • I feel that the current code for the Calculator Component is unnecessarily complex. In particular, the logic with if statements determining cases based on prevOperation, currentOperation, and operand states may be perceived as less readable to other developers. If you have any good tips on this matter, please share, and I would appreciate it.
Code
Loading...

Please log in to post a comment

Log in

Community feedback

No feedback yet. Be the first to give feedback on Lee’s solution.

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord