-
Not sure if I made it responsive the right way/as best as possible. Thoughts on how can i improve?
-
Did I use media queries right? I haven't learned SASS yet, so I feel like my code is a bit messy. What do you guys think?
Beygs
@BeygsAll comments
- @georged17Submitted over 3 years ago@BeygsPosted over 3 years ago
Hi!
You should try to center the stats part in mobile view ๐ Apart from that, good job!
0 - @Marmar28Submitted over 3 years ago
I'm looking to get reviews in how I code. I'm very interested indeveloping my skills as a web developer and I would like some tips on what are the best naming convention on CSS
@BeygsPosted over 3 years agoHi! I can't see your page neither. I think you should try to put the content of your repository "stats-preview-card-component-main" at the root of your main branch.
0 - @tedikoSubmitted over 3 years ago
Hello๐!
It was one of the most enjoyable challenges I have done so far. When I saw that challenge requires a change theme I decided to add another functionality which is extra "custom" theme where the user can edit freely colors in theme modal. Many times, when I finished a certain function, I had an idea with another one, and I had a lot of fun doing it. Honestly, It took me more time to made this custom modal than the calculator itself - which itself was a good javascript challenge as well. You can use both the keyboard and the mouse to enter data into the calculator. List of things I learned or used creating this project:
- Added customizable settings for 4th theme. User selected colors are saved in Local Storage so the settings are saved and loaded when the user will come back to the site. The user can set 13 options, but he doesn't have to change all of them, he can only change those that interest him. To get the color from user I used vanilla-picker library which creates a color palette from which to choose. Palette always show current set color of element you want to change so it is easy to adjust colors back and forth without searching for that color again.
- Added prefers-color-scheme CSS media feature which is used to detect if the user has requested a light or dark color theme and save it to Local Storage. I made it with window interface
matchMedia()
method. It returns a newMediaQueryList object
that can then be used to determine if the document matches the media query string. In this case prefers-color-scheme. Read more(1). How to detect user prefered theme in JS(2). - Implemented focus trap inside modal to make it ADA compliant. Focus trap in short prevent our focus go outside the modal once the modal is opened. Read more.
- While displaying the result, I used
toLocaleString()
method to return a string with a language-sensitive representation of this number. In short it convert 3500 to 3,500 if in U.S. Read more. - I tried to make my comments more readable and transparent. For this purpose, I used JavaScript description comments which are equivalent to Python docstring. If you precede your function definitions with a description comment, VSCode will pick it up and include it as a tooltip. Itโs like having MDN right there in your editor. Read more.
- I used
object literals
instead ofif statement
in several cases. Shortly, we have an object where the keys are the conditions and the values are the responses. Then we can use the square bracket notation to select the correct value of the object from the argument passed in. This looks clean and I will definitely continue to use this. Read More. - Of the things that are invisible at first glance, the calculator returns a error message after the user divides by zero and also after you calculate one result you can click/input equal button again and it will perform same operation again. For example 2+2=4 and another click will be 6 since result our previous equation was 4 and our last input was 2 so 4+2=6.
You can find more about the things I used in the project in the README on github. I just wanted to point out new things here.
Special thanks to @brasspetals for tossing an idea with the focus trap which she used in her project. No specific questions here but any additional feedback will be appreciated! Let me know if you spot any bugs. I know they're hiding somewhere! ๐
Thanks! ๐
- @Yellow-MaySubmitted over 3 years ago
Any question/comments is readily welcomed
@BeygsPosted over 3 years agoNice one, but when enter a number with a lot of digits it overflows to the left of the calculator screen.
1