Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Social Media Dashboard (React and SASS)

bem, react, sass/scss, typescript, vite
Scott Ning•170
@ning-sy210
A solution to the Social media dashboard with theme switcher challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


This was a really fun project to work on! I did have some troubles with the responsive design though, especially the divider that appears on smaller screens to separate the title and the theme toggle.

There is one particular area that I would like to seek some advice on. My <main> section is positioned absolutely on top of the .app-top-bg element. Because of this, the parent element (containing both my .app-top-bg and <main> elements) "wraps" around the app-top-bg element only, since it is part of the normal document flow but not the <main> element.

Coincidentally, this looks fine in light theme because the background color of the app is white in light theme, which is the default for the html body. But when in dark theme or if the background color of the light theme was to be different, the background color of the application will remain the html body default (i.e. white). This is not because the background color isn't applied, but because the background element with the background color applied has height equal to the .app-top-bg element.

The workaround I found for this was to use document.querySelector to select the parent element using its classname, and get its scrollHeight so as to set the height of the parent element. This works, but I'm not really satisfied with it, since to a certain extent, I would consider it to be hardcoding. As such, I'm wondering if there is a better way to approach this.

Also, I would like to ask for feedback in the following areas (but not limited to):

  • structure of the react components
  • structure of the CSS files
  • the semantics of the html tags used

Any comments on how they could have been done differently (and better) or in any other areas are also welcome!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Scott Ning's solution.

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.