-
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.
Merge pull request #1082 from City-of-Helsinki/UHF-9508-unit-contact-…
…card UHF-9508 & UHF-10769: Change unit contact card layout and improve accessibility
- Loading branch information
Showing
6 changed files
with
99 additions
and
180 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 |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules/**/* | |
webpack.config.js | ||
webpack.config.dev.js | ||
webpack.config.build.js | ||
src/js/calculator/*/tests/* |
Large diffs are not rendered by default.
Oops, something went wrong.
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
114 changes: 57 additions & 57 deletions
114
templates/paragraphs/paragraph--unit-contact-card.html.twig
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,82 +1,82 @@ | ||
{# This is shown twice in DOM, to move it between mobile and desktop versions maintaining logical tabbing order #} | ||
{% set unit_contact_card_details %} | ||
{% if unit_contact_card.details|render %} | ||
<div class="unit-contact-card__info-row unit-contact-card__info-row--details"> | ||
<div class="unit-contact-card__info-row__title">{{ 'Additional details'|t }}:</div> | ||
<div class="unit-contact-card__info-row__content">{{ unit_contact_card.details }}</div> | ||
</div> | ||
{% endif %} | ||
{% endset %} | ||
{% if unit_contact_card.picture_url|render or unit_contact_card.picture_url_override|render %} | ||
{% set with_image_class = 'component--unit-contact-card--with-image' %} | ||
{% endif %} | ||
|
||
{% block paragraph %} | ||
{% embed "@hdbt/misc/component.twig" with | ||
{ | ||
component_classes: [ | ||
'component--unit-contact-card', | ||
with_image_class | ||
], | ||
component_title: unit_contact_card.title, | ||
component_content_class: [ | ||
'unit-contact-card', | ||
unit_contact_card.left_column_empty ? 'unit-contact-card--left-column-empty', | ||
unit_contact_card.details_on_left ? 'unit-contact-card--details-on-left', | ||
'unit-contact-card' | ||
], | ||
} | ||
%} | ||
{% block component_content %} | ||
{% if unit_contact_card.address|render %} | ||
<div class="unit-contact-card__info-row unit-contact-card__info-row--address"> | ||
<div class="unit-contact-card__info-row__title">{{ 'Visiting address'|t }}:</div> | ||
<div class="unit-contact-card__info-row__content">{{ unit_contact_card.address }}</div> | ||
</div> | ||
{% endif %} | ||
|
||
{% if unit_contact_card.picture_url_override|render or unit_contact_card.picture_url|render or unit_contact_card.details|render %} | ||
<div class="unit-contact-card__image-with-details"> | ||
{% if unit_contact_card.picture_url_override|render or unit_contact_card.picture_url|render %} | ||
{% set picture_classes = 'unit-contact-card__image' %} | ||
{% set image_attributes = create_attribute() %} | ||
<div{{ image_attributes.addClass(picture_classes) }}> | ||
{% if unit_contact_card.picture_url_override|render %} | ||
{{ unit_contact_card.picture_url_override }} | ||
{% elseif unit_contact_card.picture_url|render %} | ||
{{ unit_contact_card.picture_url }} | ||
{% endif %} | ||
</div> | ||
{% if unit_contact_card.picture_url|render or unit_contact_card.picture_url_override|render %} | ||
<div class="unit-contact-card__image"> | ||
{% if unit_contact_card.picture_url_override|render %} | ||
{{ unit_contact_card.picture_url_override }} | ||
{% elseif unit_contact_card.picture_url|render %} | ||
{{ unit_contact_card.picture_url }} | ||
{% endif %} | ||
{{ unit_contact_card_details }} | ||
</div> | ||
{% endif %} | ||
|
||
{% if unit_contact_card.address_postal|render %} | ||
<div class="unit-contact-card__info-row unit-contact-card__info-row--address"> | ||
<div class="unit-contact-card__info-row__title">{{ 'Postal address'|t }}:</div> | ||
<div class="unit-contact-card__info-row__content">{{ unit_contact_card.address_postal }}</div> | ||
</div> | ||
{% endif %} | ||
<div class="unit-contact-card__info"> | ||
<h2 class="component__title">{{ unit_contact_card.title }}</h2> | ||
|
||
{% if unit_contact_card.phone|render %} | ||
<div class="unit-contact-card__info-row unit-contact-card__info-row--phone"> | ||
<div class="unit-contact-card__info-row__title">{{ 'Telephone number'|t }}:</div> | ||
<div class="unit-contact-card__info-row__content">{{ unit_contact_card.phone }}</div> | ||
</div> | ||
{% endif %} | ||
{% if unit_contact_card.address|render %} | ||
<div class="unit-contact-card__info-row unit-contact-card__info-row--address"> | ||
<div class="unit-contact-card__info-row__title">{{ 'Visiting address'|t }}:</div> | ||
<div class="unit-contact-card__info-row__content">{{ unit_contact_card.address }}</div> | ||
</div> | ||
{% endif %} | ||
|
||
{% if unit_contact_card.opening_hours|render %} | ||
<div class="unit-contact-card__info-row unit-contact-card__info-row--opening-hours"> | ||
<div class="unit-contact-card__info-row__title">{{ 'Opening hours'|t }}:</div> | ||
<div class="unit-contact-card__info-row__content">{{ unit_contact_card.opening_hours }}</div> | ||
</div> | ||
{% endif %} | ||
{% if unit_contact_card.address_postal|render %} | ||
<div class="unit-contact-card__info-row unit-contact-card__info-row--address"> | ||
<div class="unit-contact-card__info-row__title">{{ 'Postal address'|t }}:</div> | ||
<div class="unit-contact-card__info-row__content">{{ unit_contact_card.address_postal }}</div> | ||
</div> | ||
{% endif %} | ||
|
||
{{ unit_contact_card_details }} | ||
{% if unit_contact_card.phone|render %} | ||
<div class="unit-contact-card__info-row unit-contact-card__info-row--phone"> | ||
<div class="unit-contact-card__info-row__title">{{ 'Telephone number'|t }}:</div> | ||
<div class="unit-contact-card__info-row__content">{{ unit_contact_card.phone }}</div> | ||
</div> | ||
{% endif %} | ||
|
||
{% if unit_contact_card.unit_url %} | ||
<div class="unit-contact-card__info-row unit-contact-card__link-wrapper"> | ||
{% set unit_link_attributes = { 'class': [ 'unit-contact-card__link', ], } %} | ||
{{ link('Unit homepage'|t, unit_contact_card.unit_url, unit_link_attributes) }} | ||
</div> | ||
{% endif %} | ||
{% if unit_contact_card.opening_hours|render %} | ||
<div class="unit-contact-card__info-row unit-contact-card__info-row--opening-hours"> | ||
<div class="unit-contact-card__info-row__title">{{ 'Opening hours'|t }}:</div> | ||
<div class="unit-contact-card__info-row__content">{{ unit_contact_card.opening_hours }}</div> | ||
</div> | ||
{% endif %} | ||
|
||
{% if unit_contact_card.details|render %} | ||
<div class="unit-contact-card__info-row unit-contact-card__info-row--details"> | ||
<div class="unit-contact-card__info-row__title">{{ 'Additional details'|t }}:</div> | ||
<div class="unit-contact-card__info-row__content">{{ unit_contact_card.details }}</div> | ||
</div> | ||
{% endif %} | ||
|
||
{% if unit_contact_card.unit_url %} | ||
<div class="unit-contact-card__info-row unit-contact-card__link-wrapper"> | ||
{% set link_title %} | ||
<span class="visually-hidden"> | ||
{{- unit_contact_card.title.0['#context'].value ~ ':' -}} | ||
</span> | ||
{{- 'See details'|t({}, {'context': 'Unit contact card'}) -}} | ||
{% endset %} | ||
{% set unit_link_attributes = { 'class': [ 'unit-contact-card__link' ], } %} | ||
{{ link(link_title, unit_contact_card.unit_url, unit_link_attributes) }} | ||
</div> | ||
{% endif %} | ||
</div> | ||
{% endblock component_content %} | ||
{% endembed %} | ||
{% endblock paragraph %} |
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