This repository has been archived by the owner on Jun 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #852 from massgov/feature/dp-7363-image-srcset
DP-7363: Image srcset
- Loading branch information
Showing
11 changed files
with
73 additions
and
10 deletions.
There are no files selected for viewing
Binary file modified
BIN
+463 Bytes
(100%)
...topjs/reference/regression_page_press-release-with-image_0_document_0_phone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
___DESCRIPTION___ | ||
Added | ||
Minor | ||
- DP-7363: Enable srcset on the image pattern and demonstrate usage on Press Release with Image Page |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,24 @@ | ||
<img | ||
class="ma__image{% if image.shape %} {{ image.shape }}{% endif %}" | ||
alt="{{ image.alt }}" | ||
src="{{ image.src }}" | ||
height="{{ image.height }}" | ||
width="{{ image.width }}" /> | ||
<img | ||
class="ma__image{% if image.shape %} {{ image.shape }}{% endif %}" | ||
alt="{{ image.alt }}" | ||
src="{{ image.src }}" | ||
{% if image.versions %} | ||
srcset=" | ||
{% for version in image.versions %} | ||
{% if version.url and version.width %} | ||
{{ version.url }} {{ version.width }}{% if not loop.last %},{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
" | ||
{% if image.sizes %} | ||
{# Only use sizes if certain breakpoints limit the width of the image to less than approximately full width #} | ||
sizes="{{ image.sizes }}" | ||
{% endif %} | ||
{% endif %} | ||
{% if image.height %} | ||
height="{{ image.height }}" | ||
{% endif %} | ||
{% if image.width %} | ||
width="{{ image.width }}" | ||
{% endif %} | ||
/> |
20 changes: 20 additions & 0 deletions
20
styleguide/source/_patterns/01-atoms/09-media/image~responsive.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"image": { | ||
"alt": "alt text", | ||
"src": "../../assets/images/placeholder/800x400.png", | ||
"versions": [ | ||
{ | ||
"url": "../../assets/images/placeholder/400x200.png", | ||
"width": "620w" | ||
}, | ||
{ | ||
"url": "../../assets/images/placeholder/700x350.png", | ||
"width": "780w" | ||
}, | ||
{ | ||
"url": "../../assets/images/placeholder/800x400.png", | ||
"width": "910w" | ||
} | ||
] | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.