Does anyone know how I could host my react project? Like should I use npm run build before pushing to my repo or what?
Alex Daniel
@p-alexAll comments
- @ahmedmelfaySubmitted over 3 years ago@p-alexPosted over 3 years ago
You can use Vercel to host your react apps. It's really easy and it's free. You just have to log in with your Github account and then choose the repo you want to deploy.
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! π
@p-alexPosted over 3 years agoWell done @tediko! The color configuration feature was a great idea. Amazing project!
1 - @BarabazsSubmitted over 3 years ago
Constructive feedback is always appreciated.
@p-alexPosted over 3 years agoHey @Barabazs! Everything looks perfect to me, but you have some easy to solve report issues like the name attributes of the inputs being empty.
Great Job!!
Marked as helpful0