Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 24 days ago

Article preview component

newJSHacker•90
@laravue-18
A solution to the Article preview component 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?

Clean Structure and Layout: You've built a responsive, well-structured component using semantic HTML (<article>, <h1>, <p>, etc.) and Tailwind CSS. The use of flexbox for alignment and responsive classes like md:flex-row is solid.

Alpine.js Interactivity: You're using Alpine.js to toggle the share popup effectively. The use of x-data, @click, x-show, and x-transition is correct and keeps the logic lightweight and declarative — perfect for this kind of UI component.

Responsive Design Consideration: You've considered how the UI shifts between mobile and desktop, especially in the way the share popup is positioned (md:left-1/2 md:bottom-full etc.), which shows good attention to UX across devices.

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

🔄 Toggle Logic for the Share Popup (with Alpine.js): Ensuring the share popup appears in the right position and closes correctly on outside click or button toggle can be tricky, especially with Alpine.js, where component reactivity is declarative but limited compared to full frameworks.

📱 Responsive Positioning of Popup: On mobile, the popup needed to be placed above the share button, while on desktop, it had to be positioned differently (bottom-full and left-1/2). Tailoring this behavior with Tailwind’s responsive utilities and absolute positioning took experimentation and trial-and-error to get it pixel-perfect.

📦 Z-Index and Layering Conflicts: When using Tailwind’s utility classes like z-20, absolute, and positioning, it can be easy to have layering issues, especially if the share popup ends up behind other content — or overlaps improperly.

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

Accessibility Improvements (a11y): I’d appreciate guidance on making the share popup more accessible — for example, ensuring keyboard navigation, focus trapping, ARIA roles, and screen reader compatibility.

Transition and Animation Enhancements: While I used basic Alpine.js transitions (x-transition), I’d like to explore smoother, more engaging animations — maybe using a minimal library like GSAP or improving timing/easing within Tailwind’s utility constraints.

Handling Edge Cases and Robustness: I’m interested in better ways to handle edge cases like:

When multiple components are open at once

When window resizes mid-interaction

Preventing accidental popup closure when interacting near the edge

Scalability & Reusability: I'd like advice on abstracting the popup logic into a reusable component or Alpine.js plugin/module to prevent duplication if I use this across different buttons or modals in the app.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on newJSHacker'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
Frontend Mentor logo

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.