- Published on
O Canada
- Authors
- Name
- Tails Azimuth
O Canada
The scenic lands of Canada featuring maple leaves, snow-capped mountains, turquoise lakes and Toronto. Take in the sights in this photo gallery exhibition and see how easy it is to replicate with some MDX magic and tailwind classes.
Features images served using next/image
component. The locally stored images are located in a folder with the following path: /static/images/canada/[filename].jpg
Since we are using mdx, we can create a simple responsive flexbox grid to display our images with a few tailwind css classes.
Gallery
Implementation
<div className="flex flex-wrap -mx-2 overflow-hidden xl:-mx-2"> <div className="my-1 px-2 w-full overflow-hidden xl:my-1 xl:px-2 xl:w-1/2"> <Image alt="Maple" src="/static/images/canada/maple.jpg" width={640} height={427} /> </div> <div className="my-1 px-2 w-full overflow-hidden xl:my-1 xl:px-2 xl:w-1/2"> <Image alt="Lake" src="/static/images/canada/lake.jpg" width={640} height={427} /> </div> <div className="my-1 px-2 w-full overflow-hidden xl:my-1 xl:px-2 xl:w-1/2"> <Image alt="Mountains" src="/static/images/canada/mountains.jpg" width={640} height={427} /> </div> <div className="my-1 px-2 w-full overflow-hidden xl:my-1 xl:px-2 xl:w-1/2"> <Image alt="Toronto" src="/static/images/canada/toronto.jpg" width={640} height={427} /> </div></div>
Note: Currently, one has to use the Image
component instead of the markdown syntax between jsx. Thankfully, it's one of the default components passed to the MDX Provider and can be used directly.
When MDX v2 is ready, one could potentially interleave markdown in jsx directly! Follow MDX v2 issues for updates.
Photo Credits
Maple photo by Guillaume Jaillet on Unsplash
Lake photo by Tj Holowaychuk on Unsplash
Toronto photo by Matthew Henry on Unsplash