Skip to content

StephanUllmann/calculator-app

Repository files navigation

Frontend Mentor - Calculator app solution

This is a solution to the Calculator app challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • See the size of the elements adjust based on their device's screen size
  • Perform mathmatical operations like addition, subtraction, multiplication, and division
  • Adjust the color theme based on their preference
  • Bonus: Have their initial theme preference checked using prefers-color-scheme (done) and have any additional changes saved in the browser (not done yet)

Screenshot

Desktop Version - Theme 1 Mobile Version - Theme 3

Links

My process

Built with

  • Semantic HTML5 markup
  • SCSS
  • Flexbox
  • CSS Grid
  • JavaScript

What I learned

HTML:
  • using emmet to write repetitive markup quickly
CSS/SCSS:
  • ::before and ::after pseudo-elements will stay above its parent element beside their z-idexes

    • to cover one pseudo-element you'll need another
    • selecting them for animation is weird
  • using css custom properties in sacc functions doesn't work

    • it might with sass interpolation(#{} - syntax), but I didn't figure out how
    • using filter: brightness() instead
  • selector by tag attribute ([data-val="something"])

  • setting the height of the body/main wrapping element depending on viewport height resulted in strange renderings

    • used JavaScript to set height on window.innerHeight
  • switching color themes by declaring css classes full of custom properties and adding it to the body via JS

JavaScript
  • listening to keypress and keyup events and mapping them to functions

  • figuring out how to solve a chain of arithmetic operations in the right order

  • reading the result of a css media query via js: (window.matchMedia("(prefers-color-scheme: dark)"))

Continued development

  • writing cleaner SCSS - using more mixins and variables
  • writing cleaner JS by encapsulating data and functions
  • still not comfortable with forms and input elements

Author

Stephan Ullmann

Acknowledgments

I learned so much from the courses of Jonas Schmedtmann.

About

Calculator app challenge from frontmentor.io

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published