Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 3 years ago

Github User Search App - HTML5/SASS with Partials/vanillaJS

sass/scss
DanielK•440
@DanK1368
A solution to the GitHub user search app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi guys, this is my solution to the challenge. It was really fun. Hoping to hear feedback regarding anything and everything about my code.

A few questions that I have:

Pertaining JS

  1. Is this a good way to write the JS? I feel like I'm doing so many if/else statements to display the intended content. I feel like I can somehow cycle through it, but wasn't sure how to get it done.

  2. The page that is loaded onto the website, is suppose to be the "octocat" user. I have manually set the info in my HTML to display it. How can I fetch the data of that user on first load of the website though?

  3. When the website gets first loaded it's suppose to detect the color-scheme and adjust the automatically. I feel like it's working in Firefox but not in Chrome. Also If I toggle between light/dark theme in firefox it adjust automatically, not in chrome?

Pertaining to SASS I've been trying to become better in organizing my code through partials, although it's probably too much for this project. But it's just for me to practice.

  1. I'm still not sure if I am doing it right? Is this the way?

  2. How do you guys go about styling your html when using the partials? I find it a bit difficult if you are used to just working with 1 single sass/css sheet. I feel like I am jumping back & fourth between folders. Any tips on how to be more efficient?

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Vanza Setia•27,715
    @vanzasetia
    Posted almost 3 years ago

    Hello, DanielK! 👋

    Regarding your JavaScript questions:

    • I used a lot of if..else statements too. But the way I wrote them was by separating them into small functions. I would recommend you do the same so that it is much more maintainable and also makes your code much easier to understand. It's because, with functions, you can name the function which means you can give descriptive name to help others to understand your code.
    • I also showed Octocat's profile with HTML. But to answer your question, you can make the document object listen to the DOMContentLoaded. Then, fetch Octocat's GitHub profile.
    • For the color scheme, my browser's color scheme preference is set to dark. But, when I first load the site, the website shows a light color preference. Then, when I switch my browser's color scheme preference to light, the website becomes dark mode. Also, I can't switch the theme of the site.

    About Sass, I think the purpose of Sass is to help us organize our CSS by having multiple Sass files. For me, it helps me separate the styling for each component. So, I have no problem with jumping from one file to another file. Also, Sass has @mixin and @function which really helps me write CSS. For example, I created rem() function to convert px to rem unit.

    So, to answer your question, I took a look at the compiled code and I would say that you have used it accordingly. The common mistake that I did when I started using Sass was to nest selectors unnecessarily. It is bad practice because it produces high specificity stylesheet. But, you don't do it, so great! 👍

    Some suggestions:

    • I would recommend reading "A Theme Switcher | Inclusive Components" and "Toggle Buttons | Inclusive Components" articles to create accessible theme switcher. Currently, it is not an interactive element which means the screenreaders will not know that it is an interactive element.
    • Always specify the type of the button. In this case, set the type of the search button as type="submit". It will prevent the button from behaving unexpectedly.
    • Put the script tag above the ending body tag. I recommend taking a look at the StackOverflow discussion about this.
    • I would recommend taking a look at the page without any styling. Then, see if you could understand the page content. If you are not able to understand the page content then there might be something wrong with the HTML. For example, the profile__stats should be a list, and the category of the statistic (Repos, Followers, and Following) should not be a heading.

    That's it! I hope you find this useful! 🙂

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
Frontend Mentor logo

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