-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add image atom, blur images with missing alt tags (#281)
Resolves #230.
- Loading branch information
Ned Zimmerman
authored
Mar 26, 2020
1 parent
225b6c5
commit 2e89f54
Showing
6 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
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,11 @@ | ||
img { | ||
border-style: none; | ||
display: block; | ||
height: auto; | ||
max-width: 100%; | ||
vertical-align: middle; | ||
} | ||
|
||
img:not([alt]) { | ||
filter: blur(rem(10)); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
title: 'Image', | ||
status: 'wip', | ||
order: 11, | ||
context: { | ||
src: '/images/person.jpg', | ||
width: 367, | ||
height: 250, | ||
alt: 'Photograph of Trebor Scholz', | ||
role: false | ||
}, | ||
variants: [ | ||
{ | ||
name: 'Decorative', | ||
context: { | ||
alt: '', | ||
role: 'presentation' | ||
} | ||
}, | ||
{ | ||
name: 'Missing Alternative Text', | ||
context: { | ||
alt: false | ||
} | ||
} | ||
] | ||
}; |
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,10 @@ | ||
{% set altAttribute = false %} | ||
{% if alt !== false %} | ||
{% set altAttribute = 'alt="' + alt + '"' %} | ||
{% endif %} | ||
{% set roleAttribute = false %} | ||
{% if role !== false %} | ||
{% set roleAttribute = 'role="' + role + '"' %} | ||
{% endif %} | ||
|
||
<img {{ roleAttribute | safe if roleAttribute else '' }} src="{{ src }}" width="{{ width }}" height="{{ height }}" {{ altAttribute | safe if altAttribute else '' }} /> |
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