Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 9 months ago

News homepage built with React and TailwindCSS

accessibility, react, tailwind-css, typescript
Jenny Eikens•250
@Jenny-Eikens
A solution to the News homepage challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I learned more about CSS grid for this project. I found the use of grid-template-areas in particular very helpful for creating the responsive layout of the page. This approach saved me a lot of time and effort.

What challenges did you encounter, and how did you overcome them?

By far the biggest challenge for me in this project was the nav bar. I am not super confident in the realm of positioning in general and conditional positioning especially. It took me a while to get to the point where I could display the nav at the top on bigger screens and have it slide in from the side on smaller screens.

I also had never previously worked with an overlay for when the side menu is open, so that was a challenge as well. Overall, I'd like to keep working on my CSS grid skills and get more confident in positioning elements.

I also noticed that I don't yet fully understand how to pass variables and functions down as props in React, which is something I would like to work on in future projects.

What specific areas of your project would you like help with?

There's is a horizontal scrollbar at the bottom of my page and I don't understand why that is. If someone can point me to any flaws in my styling that might be causing an overflow, please go ahead!

Also, this is not technically something I need help with, but I noticed that while the design works on laptops and mobile screens, it doesn't look super great on medium-sized screens. I guess that's just due to the layout though. I considered adding a media query to make the page a one-column layout for medium-sized screens where the articles on the right-hand side would be in a row rather than a column, but I ultimately decided against it.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Dylan Heslop•2,440
    @dylan-dot-c
    Posted 9 months ago

    Well done on this challenge especially with using react but there are a few things you can improve on...

    • Your components are a bit dense... they aren't really reusable unless someone is gonna work on the exact same challenge. To me, if you want to change a blog or update it in the future you should just change the data and not the code itself. This also comes back to the idea of hardcoding your website, in the real world you would create small components like(Latest News or TopNews) and fetch the data for them. Don't take it to heart but you are solving this like you are using vanilla js and not a framework... you need to get into that mindset.

    • You can make use of semantic elements like articles(which they infact are...lol) instead of all those divs you have there. You can also make use of the section element.

    • FOr the overflow... I can't really say... its weird but it could be some width/margin or even the mobile navbar you have why it's overflowing... can't say for sure tho. Actually...(did another quick check) it's the 100vw you have on the body element that causes the overflow, so just remove that. Also all block level elements automatically take up full width so you dont need that and the thing is that vw don't take into account the vertical scrollbar on the right so it would still take up that space and not limit it.

    Basically for making it resusable, turn the data for the blogs(the repeated parts more importantly) into an array of json objects so you can just map out them and pass it the values like title, description, image, id? that make it distinct. That's how you truly leverage the power of js frameworks. This approach could even be done with vanilla js as well. So it's important to know the fundamentals.

    You can also check out my solution(did it a long time ago so I haven't applied my new knowledge since then) but it shows how to use the components and even the images properly as you don't really need to use process.env to use images, it's better to import them and keep them in the assets folder than public which makes them easier to use.

    Marked as helpful
  • Adriano•42,890
    @AdrianoEscarabote
    Posted 9 months ago

    Hello Jenny Eikens, how are you? I was really pleased with your project, but I’d like to offer some advice that might help:

    I noticed that you used a button in which case the best option would be an a, because in my head when a person clicks on a button written Read More, he is not confirming a form, or something like, it will be redirected to another page, to Read More about!

    to solve this problem do this:

    <a href="/">Read More</a>

    The rest is spot on.

    Hope it’s helpful to you. 👍

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

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

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub