Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

News Hompage component solution

Emmanuel 150

@Hemazyn

Desktop design screenshot for the News homepage coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hello everyone!

I'm excited to share that I've completed the frontend mentor project “news-hompage-ui," and I'm reaching out to the community for your valuable feedback. Your insights will be immensely helpful in refining and improving my work. Here are some specific areas where I would love to hear your thoughts:

  • Design: Please share your feedback on the overall design, layout, and user experience. I'm curious to know if the design is appealing and if the user interface is intuitive.
  • Code Structure: I'm open to suggestions on how to enhance the organization and structure of my code. Any feedback on coding practices or ways to improve readability would be greatly appreciated.
  • Performance: If you have insights into performance optimization or notice potential bottlenecks in the code, I would love to hear your thoughts.
  • Responsiveness: How well does the website adapt to different screen sizes? Any feedback on the responsiveness of the design would be valuable.

Additionally, I'm currently facing a challenge in implementing the design for the button of scores, as outlined in the initial design challenge. Any guidance or suggestions on successfully completing this specific aspect of the project would be incredibly helpful.

I underestimated the challenge and recognize that there is always room for improvement. Your feedback is crucial in helping me grow as a developer. Thank you all for your time and consideration. I'm genuinely looking forward to hearing your thoughts and recommendations!

Best regards

Community feedback

@jebbaited

Posted

Hey!

1: Avoid using repeatable code. You work with React. Create components and pass props inside. If you don't need Component for some part of your code you could declare an array and fill it with, for example, nav names. Then just map it and you will have less code and high readability. Here is example from your repository. You use the same code 5 times and then 5 times more, but for phone view. Try to change it using advice above.

    <li className="md:px-6 text-sm md:text-sm cursor-pointer capitalize font-inter font-normal text-Dark-grayish-blue hover:text-Soft-red"
                              onClick={() => { setNav(!nav); closeNavOnLargeScreen() }}>Home</li>
                         <li className="md:px-6 text-sm md:text-sm cursor-pointer capitalize font-inter font-normal text-Dark-grayish-blue hover:text-Soft-red"
                              onClick={() => { setNav(!nav); closeNavOnLargeScreen() }}>New</li>
                         <li className="md:px-6 text-sm md:text-sm cursor-pointer capitalize font-inter font-normal text-Dark-grayish-blue hover:text-Soft-red"
                              onClick={() => { setNav(!nav); closeNavOnLargeScreen() }}>Popular</li>
                         <li className="md:px-6 text-sm md:text-sm cursor-pointer capitalize font-inter font-normal text-Dark-grayish-blue hover:text-Soft-red"
                              onClick={() => { setNav(!nav); closeNavOnLargeScreen() }}>Trending</li>
                         <li className="md:px-6 text-sm md:text-sm cursor-pointer capitalize font-inter font-normal text-Dark-grayish-blue hover:text-Soft-red"
                              onClick={() => { setNav(!nav); closeNavOnLargeScreen() }}>Categories</li>

Same propblem here:

 {/* one */}
                <div className="flex flex-col">
                  <h4 className="text text-Off-white hover:text-Soft-orange cursor-pointer mb-2">Hydrogen VS Electric Cars</h4>
                  <p className="text-Grayish-blue font-light text-sm">Will hydrogen-fueled cars ever catch up to EVs?</p>
                </div>
                <hr className="line my-3 lg:my-0" />
                {/* two */}
                <div className="flex flex-col">
                  <h4 className="text text-Off-white hover:text-Soft-orange cursor-pointer mb-2">The Downsides of AI Artistry</h4>
                  <p className="text-Grayish-blue font-light text-sm">What are the possible adverse effects of on-demand AI image generation?</p>
                </div>
                {/* three */}
                <hr className="line my-3 lg:my-0" /
.
.
.

2: When you need to handle onClick event create a function with name handleOnClick. Do inside whatever you want to and then pass this function to button onClick. And also you repeat the same function several times in your code.

 onClick={() => { setNav(!nav); closeNavOnLargeScreen() }}
 onClick={() => { setNav(!nav); closeNavOnLargeScreen() }}
 onClick={() => { setNav(!nav); closeNavOnLargeScreen() }}

3: Create Component for this part

 return (
                <div key={id} className="flex flex-row gap-5">
                  <img src={icon} alt={alt} loading="lazy" className="h-[150px]" />
                  <div className="flex flex-col gap-2 mt-2">
                    <h1 className="text-3xl font-bold text-Grayish-blue">{number}</h1>
                    <h3 className="text-Very-dark-blue font-semibold hover:text-Soft-red cursor-pointer lg:text-sm">{head}</h3>
                    <p className="text-sm lg:text-xs font-light text-Dark-grayish-blue">{body}</p>
                  </div>
                </div>
              )

Feel free to ask if you have questions.

Marked as helpful

0

Please log in to post a comment

Log in with GitHub
Discord logo

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