Skip to content
Submitted 19 days ago

Responsive Article Preview Card using Flexbox & Vanilla JS

LVL 2
@LSW0301
A solution to the Article preview component challenge

Solution retrospective


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

I am most proud of implementing the interactive share popup. Using vanilla JavaScript, I successfully toggled the .active class to show and hide the dark popup box. Furthermore, I handled the SVG icon color change perfectly by replacing the <img> tag with inline <svg> and using the currentColor property, allowing it to switch to white smoothly. Next time, I would like to focus on writing more modular CSS and perhaps adding a subtle transition animation to the popup for a better user experience.

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

The biggest challenge was handling the click events and event bubbling. Initially, when I clicked the share button to open the popup, it would immediately close because the click event bubbled up to the document. I solved this by adding event.stopPropagation() inside the button's click listener. Another challenge was getting the little triangle arrow on the popup to align perfectly with the button; I fixed this by using CSS position: absolute and adjusting the bottom and left values precisely.

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

I would love some feedback on my CSS positioning approach, especially for the popup tooltip. Is using negative margin or absolute positioning the best practice here? Also, any advice on how to write cleaner and more efficient JavaScript for handling DOM manipulation and click-outside events would be highly appreciated!

Code
Loading...

Please log in to post a comment

Log in

Community feedback

No feedback yet. Be the first to give feedback on 舜白奈伊’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