Giter VIP home page Giter VIP logo

calculator-app's Introduction

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.

calculator-app's People

Contributors

stephanullmann avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.