Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 4 years ago

Calculator app (first lvl 3 challenge)

Jonatan Frederiksen•50
@jonatanfrederiksen
A solution to the Calculator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


This was a really big project for me but im really proud of myself. struggled with the theme picker for a long time but i pretty much got it working. but i have a couple of questions id like feedback on

  • i started out without the theme picker and had button hover effects and an 'active' button style for the plus, minus, divide and multiply buttons. so that if was obvious which button was active this was done in CSS using :hover and a class for toggling. But when i changed to a theme system using JS i couldn't figure out how to modify those classes CSS classes to fit with the different themes (seems like thats not a thing i can do), so any suggestions on how i could have built those functions otherwise?

(correction: i just saw that i kept the toggle effect on the buttons but it doesn't change with the themes.)

  • i implemented a decimal systemn (and yes i intentionally use comma and dot like that (haha im not american) .. but i couldn't figure out how to allow more digits than 2 after the decimal.. so if you add more the JS behind knows the values but the display wont show it. i used this: Number(parseFloat(num).toFixed(2)).toLocaleString('da'); prepare the value for the display but this would remove the decimals.. i thought i could just modify the .toFixed(..) but it wasn't that simple and i gave up with it a bit.

lastly the display window expands if you fill it with digits.. which looks dumb.. and for some reason the themepicker switch shows up as an oval on my iphone and not the 16x16 px i've set it to im perplexed..

thank you so much for reading this far! you guys are awesome!

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Norbert Yemuang•140
    @Bope142
    Posted about 4 years ago

    Pensez aussi à la sauvegarde du tout dernier thème sélectionné par l'utilisateur avant le chargement de la page afin de lui permettre de garder son récent thème choisi… https://serene-kirch-890ea8.netlify.app/ Si non le défi est réussi !! félicitation.

  • Mehboob Mansoor Ali•0
    @mehboobsamnani
    Posted about 4 years ago

    hey Jonatan loved the effort and the end results are same , i would like to give you one feedback to add button click effect. it will definitely improve ux.

    for your refrence https://codepen.io/rauldronca/pen/Pzrgzp https://tympanus.net/Tutorials/CSSButtonsPseudoElements/index3.html#

  • P
    Patrick•14,265
    @palgramming
    Posted about 4 years ago

    you might want to look into using CSS Variables in the future to set your main color mode and then you just change the values of the variables in your JS to modify the theme https://www.w3schools.com/css/css3_variables.asp

    But it looks like you have a good start to this challenge it is not a easy one. Lots of elements and edge cases to have to figure out and plan for

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub