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

Article preview component (React and Tailwind)

mehdias63 330

@mehdias63

Desktop design screenshot for the Article preview component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

P

@tatasadi

Posted

Great job on completing this challenge! Your project showcases a good understanding of React state management and conditional rendering. However, there are a few areas where improvements could enhance functionality and code quality:

Closing the Share Panel on Desktop

Consider implementing functionality to close the share panel when clicking outside of it. This could significantly improve the user experience on desktop. One approach is to add an event listener to the window object that listens for click events and checks if the click occurred outside the share panel. If it did, close the panel.

Naming of isSubmited

The state variable isSubmited might be misleading since the action related to it is not submitting a form but toggling the visibility of the share panel. A more descriptive name like isSharePanelVisible would clarify its purpose and make your code easier to understand.

DRY Principle

It appears that the avatar and name section at the bottom of the card is repeated in your JSX. To adhere more closely to the DRY (Don't Repeat Yourself) principle and simplify your code, consider always displaying the avatar and user information section. For mobile view, you can layer the share panel on top of this information. This approach eliminates the need to repeat the avatar and user information in both state branches of your code.

Social Icons Interactivity

Ensure that your social icons are wrapped in <a> tags with appropriate href attributes pointing to the respective social platforms. This makes the icons accessible and interactive. Additionally, adding the cursor-pointer class to these icons will indicate to users that they are clickable.

IconShare as a Button

The IconShare component used for closing the share panel should be implemented as a button rather than a div. This change would improve accessibility since buttons are semantically designed for click interactions. Remember to include an aria-label attribute to describe the button's action for screen readers.

Implementing these suggestions will not only make your code cleaner and more efficient but also enhance the user interface and accessibility of your application. Keep up the excellent work!

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