Article preview component using HTML, CSS Flexbox, and JavaScript

Solution retrospective
Implementing different interactions for desktop and mobile screens using JavaScript and window.innerWidth.
How to adapt behavior conditionally depending on screen size, such as hiding and showing specific elements (e.g., showing the mobile share icon or hiding the desktop button on smaller screens).
What challenges did you encounter, and how did you overcome them?I spent a lot of time figuring out how to display the popup when clicking the share button, especially getting its style and position right. It wasn’t easy for me at first. I used absolute positioning for the popup and had to test different width and height values multiple times to make it look correct on both desktop and mobile screens. To make the popup show and hide properly, I also experimented with JavaScript and had to debug it through trial and error until I got the desired result.
What specific areas of your project would you like help with?I'm having trouble changing the color of the share icon. I used filter: brightness() to make it look white, but the result doesn’t match the design in the Figma file. I’d like to learn a better or more accurate way to style the icon so it looks the same as the design.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @thisisharsh7
Hey, fantastic work adding transitions enhances UX! Your live webpage looks good and the popup logic and positioning are clean and functional across devices.
For icon color styling: Instead of
filter: brightness()
for making icons white, try using: - An SVG icon withfill="currentColor"
and toggle the parent button’scolor
property. - OR, use a white version of the icon if provided by the design.For next projects:
- Try adding
aria-expanded
andaria-controls
to buttons for better screen reader support. - Try reusing component and style it responsively.
Overall a good solution - happy coding!
- Try adding
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