Submitted almost 2 years ago
E-commerce product page using Next.js and Tailwind
@gerrcass
Design comparison
SolutionDesign
Solution retrospective
I built an ImageGallery component that receives width/height props with the idea of making it responsive. But since I'm using Nextjs, I didn't want to deal with window.matchMedia on the server side. Therefore I decided to use the Tailwind classes for CSS media queries. The problem was that I had to concatenate classes (tailwind doesn't allow to construct class names dynamically) and finally got a solution using 'safelist' in tailwind.config.js. But something tells me there must be a better solution for this. So please if you know any better way I would really appreciate it.
Community feedback
Please log in to post a comment
Log in with GitHubJoin 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