This is a solution to the GitHub user search app challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Note: Delete this note and update the table of contents based on what sections you keep.
Users should be able to:
prefers-color-scheme
in CSS.I first started building out the UI with static data, and then implementing the API afterwards. I find this much easier than trying to do both at once as the API layer adds additional complexity that I don't want getting in my way of styling the app.
The tablet > desktop layout was tricky with the repositioning of elements. I had to really think about the HTML structure and how everything worked together. I ended up creating two blocks with the same grid columns, which ended up working well in the end.
I used SWR as my data fetching library of choice because I love how simple it is and how because if its caching, if you go back to a previous search the result loads instantly. I learned how to add options such as disabling retrying on error.
I also learned how to use Context and the window.matchMedia API to create a very simple theme switcher.