-
Notifications
You must be signed in to change notification settings - Fork 31
DP-5343 Callout Grid #578
base: dev
Are you sure you want to change the base?
DP-5343 Callout Grid #578
Changes from 7 commits
8e3761f
0c84e79
3c45abe
80202b6
78fe66b
a6cb9d3
df7ce3d
ce9cc26
d192c42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| { | ||
| "compHeading": { | ||
| "title": "Title text", | ||
| "title": "Comp Heading", | ||
| "level": "", | ||
| "color": "", | ||
| "id": "GUID9827924", | ||
| "centered": "" | ||
| "id": "GUID285724897", | ||
| "centered": false | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| { | ||
| "compHeading": { | ||
| "title": "Title text", | ||
| "title": "Comp Heading", | ||
| "sub": false, | ||
| "color": "", | ||
| "id": "", | ||
| "id": "GUID248572057", | ||
| "centered": true | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| { | ||
| "compHeading": { | ||
| "title": "Title text", | ||
| "title": "Comp Heading", | ||
| "level": 3, | ||
| "color": "", | ||
| "id": "", | ||
| "centered": "" | ||
| "centered": false | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "compHeading": { | ||
| "title": "Title text", | ||
| "title": "Comp Heading", | ||
| "sub": false, | ||
| "color": "yellow", | ||
| "id": "", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,40 +20,30 @@ | |
| {% endif %} | ||
| <div class="ma__action-finder__container"> | ||
| <header class="ma__action-finder__header"> | ||
| <h2 class="ma__action-finder__title"> | ||
| {{ actionFinder.title }} | ||
| </h2> | ||
| {# Backward compatible with 5.7 - replaced h2 with compHeading #} | ||
| {% set compHeading = actionFinder.compHeading ? : {"title": actionFinder.title, "color":"yellow","id": ""} %} | ||
|
||
| {% include "@atoms/04-headings/comp-heading.twig" %} | ||
| </header> | ||
| {% if actionFinder.featuredLinks %} | ||
| {% if actionFinder.featuredHeading %} | ||
| <h3 class="ma__action-finder__category">{{ actionFinder.featuredHeading }}</h3> | ||
| {% endif %} | ||
| <div class="ma__action-finder__items"> | ||
|
Contributor
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. I saw the backwards-compatible scss to support this selector - thank you! |
||
| {% for link in actionFinder.featuredLinks %} | ||
| {% if link.image %} | ||
| {% set illustratedLink = link %} | ||
| {% include "@molecules/illustrated-link.twig" %} | ||
| {% else %} | ||
| {% set calloutLink = link %} | ||
| {% include "@molecules/callout-link.twig" %} | ||
| {% endif %} | ||
| {% endfor %} | ||
| <div class="ma__action-finder__featured-items"> | ||
| {% set keyActions = { "links": actionFinder.featuredLinks } %} | ||
|
||
| {% if actionFinder.featuredHeading %} | ||
| <h3 class="ma__action-finder__category" id="featured-{{ actionFinder.id }}">{{ actionFinder.featuredHeading }}</h3> | ||
| {% set keyActions = keyActions|merge({"id": "featured-" ~ actionFinder.id, }) %} | ||
| {% endif %} | ||
| {% include "@organisms/by-author/key-actions.twig" %} | ||
|
Contributor
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. What's the
Author
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. ah, now I get the other comment. I'll pass the main title's id if we don't have a featured Heading. |
||
| </div> | ||
| {% endif %} | ||
| {% if actionFinder.links %} | ||
| {% if actionFinder.generalHeading and actionFinder.featuredLinks %} | ||
| <h3 class="ma__action-finder__category">{{ actionFinder.generalHeading }}</h3> | ||
| {% endif %} | ||
| <div class="ma__action-finder__items ma__action-finder__items--all"> | ||
|
Contributor
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. I saw the backwards-compatible scss to support this selector, thank you! |
||
| {% for link in actionFinder.links %} | ||
| {% if link.image %} | ||
| {% set illustratedLink = link %} | ||
| {% include "@molecules/illustrated-link.twig" %} | ||
| {% else %} | ||
| {% set calloutLink = link %} | ||
| {% include "@molecules/callout-link.twig" %} | ||
| {% endif %} | ||
| {% endfor %} | ||
| <div class="ma__action-finder__all-items"> | ||
| {% set keyActions = { "links": actionFinder.links } %} | ||
|
||
| {% if actionFinder.generalHeading and actionFinder.featuredLinks %} | ||
|
Contributor
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 wouldn't we display the
Author
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. It was a design decision. Did really make sense to say "All ..." when there aren't "featured" links above it. The heading just adds confusion. |
||
| <h3 class="ma__action-finder__category" id="all-{{ actionFinder.id }}">{{ actionFinder.generalHeading }}</h3> | ||
| {% set keyActions = keyActions|merge({"id": "all-" ~ actionFinder.id, }) %} | ||
| {% else %} | ||
| {% set keyActions = keyActions|merge({"id": actionFinder.id, }) %} | ||
|
||
| {% endif %} | ||
| {% include "@organisms/by-author/key-actions.twig" %} | ||
| </div> | ||
| {% endif %} | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ### Description | ||
| This is a variant of the [Key Actions](./?p=organisms-key-actions) pattern showing an example with the heading visually hidden to provide context for screen readers. | ||
|
|
||
| ### How to generate | ||
| * set the `hiddenHeading` variable to true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,42 @@ | ||
| { | ||
| "keyActions": { | ||
| "id": "GUID0828340", | ||
| "hiddenHeading": false, | ||
| "compHeading": { | ||
| "title": "Key Actions", | ||
| "sub": false, | ||
| "id": "key-action-id" | ||
| "id": "" | ||
| }, | ||
| "links":[{ | ||
| "image": "", | ||
| "text": "Register to Vote", | ||
| "type": "", | ||
| "href": "#" | ||
| "href": "#", | ||
| "label": "" | ||
| },{ | ||
| "image": "", | ||
| "text": "Find a Job", | ||
| "type": "", | ||
| "href": "#" | ||
| "href": "#", | ||
| "label": "" | ||
| },{ | ||
| "image": "../../assets/images/placeholder/130x160.png", | ||
| "text": "File for unemployment", | ||
| "type": "", | ||
| "href": "#", | ||
| "label": "Guide:" | ||
| },{ | ||
| "image": "", | ||
| "text": "Learn more about the tax code", | ||
| "type": "", | ||
| "href": "#" | ||
| "href": "#", | ||
| "label": "" | ||
| },{ | ||
| "image": "", | ||
| "text": "Learn more about the tax code", | ||
| "type": "", | ||
| "href": "#" | ||
| "href": "#", | ||
| "label": "" | ||
| }] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,13 +3,26 @@ | |
| {% set keyActions = keyActions|merge({"compHeading": { "title": keyActions.sidebarHeading.title, "sidebar" : true }}) %} | ||
| {% endif %} | ||
|
|
||
| <section class="ma__key-actions"> | ||
| {# fallback to compHeading Id value #} | ||
| {% set keyActionId = keyActions.compHeading.id %} | ||
|
||
|
|
||
| {% if keyActions.id %} | ||
| {% set keyActionId = keyActions.id %} | ||
| {% endif %} | ||
|
|
||
| {% set hiddenClass = keyActions.hiddenHeading ? 'ma__key-actions--hidden-heading' : '' %} | ||
|
|
||
| <section class="ma__key-actions {{ hiddenClass }}"> | ||
| <div class="ma__key-actions__container"> | ||
| {% if keyActions.compHeading %} | ||
| {% set compHeading = keyActions.compHeading %} | ||
| {% set compHeading = keyActions.compHeading|merge({"id": keyActionId}) %} | ||
|
Contributor
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. Can you explain why this is necessary? (I know we talked about it!) If there is a
Author
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. What we want to always use is the keyActions.id value. If that hasn't been passed then we fallback to the compHeading.id. If that hasn't been passed then we fall back to a blank id, because unlabeled is better than mis-labeled. |
||
| {% include "@atoms/04-headings/comp-heading.twig" %} | ||
| {% endif %} | ||
| <div class="ma__key-actions__items" aria-labelledby="{{ keyActions.compHeading.id }}"> | ||
| <div | ||
| class="ma__key-actions__items" | ||
| {% if keyActionId %} | ||
| aria-labelledby="{{ keyActionId }}" | ||
|
Contributor
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. I remember talking about the heading / labelledby id stuff, just want to make sure I understand what's happening here: When key actions is used as a standalone component, it will generally have a When key actions is included as a child component (i.e. Am I understanding this correctly?
Author
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. correct. |
||
| {% endif %}> | ||
| {% for link in keyActions.links %} | ||
| {% if link.image %} | ||
| {% set illustratedLink = link %} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| "keyActions": { | ||
| "id": "GUID0828340", | ||
| "hiddenHeading": true, | ||
| "compHeading": { | ||
| "title": "Key Actions", | ||
| "sub": false, | ||
| "id": "" | ||
| }, | ||
| "links":[{ | ||
| "text": "Register to Vote", | ||
| "type": "", | ||
| "href": "#" | ||
| },{ | ||
| "text": "Find a Job", | ||
| "type": "", | ||
| "href": "#" | ||
| },{ | ||
| "image": "../../assets/images/placeholder/130x160.png", | ||
| "text": "File for unemployment", | ||
| "type": "", | ||
| "href": "#", | ||
| "label": "Guide:" | ||
| },{ | ||
| "text": "Learn more about the tax code", | ||
| "type": "", | ||
| "href": "#" | ||
| },{ | ||
| "text": "Learn more about the tax code", | ||
| "type": "", | ||
| "href": "#" | ||
| }] | ||
| } | ||
| } |
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.
Nice!