Last active
August 2, 2019 23:53
-
-
Save mrtag23/9343b10cb35f1f8a4c82e96c8b60a5a0 to your computer and use it in GitHub Desktop.
Simple picture component for pattern lab.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"breakpoints": { | |
"desktop": "all and (min-width: 1200px)", | |
"tablet": "all and (min-width: 768px) and (max-width: 1199px)", | |
"mobile": "all and (max-width: 767px)" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<picture> | |
{% for key, source in sources %} | |
<source media="{{ breakpoints[key] }}" srcset="{{ source }}"> | |
{% endfor %} | |
<img src="{{ src }}" alt="{{ alt }}"> | |
</picture> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sources: | |
desktop: "https://via.placeholder.com/1920x1080?text=Desktop+image" | |
tablet: "https://via.placeholder.com/1200x900?text=Tablet+image" | |
mobile: "https://via.placeholder.com/768x500?text=Mobile+image" | |
src: "https://via.placeholder.com/1920x1080?text=Fallback+image" | |
alt: "Vestibulum ante ipsum" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment