-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(media-container): add expandable - FRONT-4017 #2943
Merged
Merged
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ee842a0
add infography, fix dependency
emeryro 8ae9da4
update test
emeryro e9e0cf3
add aria
emeryro 3d70409
update test
emeryro 56874a2
update test
emeryro 3901925
Merge branch 'v3.9.0-dev' into FRONT-4017-media-container-expandable
emeryro 8c779d9
apply feedback
emeryro 9ef1e86
fix display
emeryro 3159e30
update test
emeryro 2862a54
Merge branch 'v3.9.0-dev' into FRONT-4017-media-container-expandable
emeryro ce64791
Merge branch 'v3.9.0-dev' into FRONT-4017-media-container-expandable
emeryro a2b0b06
fix story and twig
emeryro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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 |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
Parameters: | ||
- "picture" (associative array) (default: {}): Image for media container, following ECL Picture structure | ||
- "full_width": (bool) (default: false) Full width media container (inside the grid container) | ||
- "extra_classes" (string) (default: ''), | ||
- "sources" (array) (default: []): format: [ | ||
{ | ||
"src" (string) (default: ''), | ||
|
@@ -22,14 +21,16 @@ | |
], | ||
- "image" (string) (default: ''): Image to be used as the video placeholder | ||
- "description" (string) (default: ''), | ||
- "ratio" (string) ('') | ||
- "expandable" (associative array) (default: {}): Optional expandable block, following ECL Expandable structure | ||
- "extra_classes" (string) (default: ''), | ||
- "extra_attributes" (array) (default: []): format: [ | ||
{ | ||
"name" (string) (default: ''), | ||
"value" (string) (default: '') | ||
}, | ||
... | ||
] | ||
- "ratio" (string) ('') | ||
|
||
Blocks: | ||
- "embedded_media" | ||
|
@@ -54,6 +55,7 @@ | |
{% set _ratio = ratio|default('') %} | ||
{% set _sources = sources|default({}) %} | ||
{% set _tracks = tracks|default({}) %} | ||
{% set _expandable = expandable|default({}) %} | ||
|
||
{# Internal logic - Process properties #} | ||
|
||
|
@@ -81,6 +83,10 @@ | |
{% set _css_class = _css_class ~ ' ' ~ extra_classes %} | ||
{% endif %} | ||
|
||
{% if _expandable is not empty and _expandable.id is defined %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not setting this as an item of extra_attributes instead of building the string manually? |
||
{% set _extra_attributes = _extra_attributes ~ ' aria-describedby="' ~ _expandable.id ~ '-content"' %} | ||
{% endif %} | ||
|
||
{% if extra_attributes is defined and extra_attributes is not empty and extra_attributes is iterable %} | ||
{% for attr in extra_attributes %} | ||
{% if attr.value is defined %} | ||
|
@@ -93,6 +99,10 @@ | |
|
||
{# Print the result #} | ||
|
||
{% if _expandable is not empty %} | ||
planctus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<div class="ecl-media-container__container"> | ||
{% endif %} | ||
|
||
<figure class="{{ _css_class }}"{{ _extra_attributes|raw }}> | ||
{% if _embedded_media is not empty %} | ||
{% set _embed_class = _ratio ? "ecl-media-container__media ecl-media-container__media--ratio-" ~ _ratio : "ecl-media-container__media" %} | ||
planctus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -133,4 +143,11 @@ | |
{% endif %} | ||
</figure> | ||
|
||
{% if _expandable is not empty %} | ||
{% include '@ecl/expandable/expandable.html.twig' with _expandable|merge({ | ||
extra_classes: 'ecl-media-container__expandable', | ||
}) only %} | ||
</div> | ||
{% endif %} | ||
|
||
{% endapply %} |
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
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
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
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
26 changes: 26 additions & 0 deletions
26
src/specs/components/media-container/demo/data--infography.js
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,26 @@ | ||
module.exports = { | ||
picture: { | ||
img: { | ||
src: 'https://inno-ecl.s3.amazonaws.com/media/examples/example-image2.jpg', | ||
alt: 'Infography alt text', | ||
}, | ||
}, | ||
description: 'Infography title and copyright', | ||
expandable: { | ||
id: 'expandable-example', | ||
button: { | ||
label: 'Collapsed', | ||
variant: 'secondary', | ||
icon: { | ||
name: 'corner-arrow', | ||
transform: 'rotate-180', | ||
size: 'fluid', | ||
path: '/icons.svg', | ||
}, | ||
}, | ||
label_expanded: 'Expanded', | ||
label_collapsed: 'Collapsed', | ||
content: | ||
'<p class="ecl-u-type-paragraph-m">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In et varius est. Sed elementum rutrum libero, at vulputate nisl posuere et. Morbi dui sem, rhoncus non fermentum eget, finibus non purus.</p>', | ||
}, | ||
}; |
2 changes: 2 additions & 0 deletions
2
src/website/src/pages/ec/components/media/media-container/demo/index.js
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,8 +1,10 @@ | ||
import demoContentImg from '@ecl/specs-component-media-container/demo/data--image'; | ||
import demoContentVideo from '@ecl/specs-component-media-container/demo/data--video'; | ||
import demoContentEmbed from '@ecl/specs-component-media-container/demo/data--embed-video'; | ||
import demoContentInfography from '@ecl/specs-component-media-container/demo/data--infography'; | ||
import template from '@ecl/twig-component-media-container/media-container.html.twig'; | ||
|
||
export const mediaContainerImg = template(demoContentImg); | ||
export const mediaContainerVideo = template(demoContentVideo); | ||
export const mediaContainerEmbed = template(demoContentEmbed); | ||
export const mediaContainerInfography = template(demoContentInfography); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it felt there was something strange since you are receiving the labels and not the values in the args object, this is due to a reverse mapping, it should be:
and then you would deal with the values here, the same in the url ;)