Skip to content
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

UHF-5532: Contact card visual adjustments #910

Merged
merged 8 commits into from
Feb 26, 2024
2 changes: 1 addition & 1 deletion dist/css/styles.min.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions src/scss/06_components/paragraphs/_contact-card-listing.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
$contact-card-max-width: 200px;
$contact-card-gap: $spacing-and-half;
// The width when two cards don't fit next to each other anymore.
$contact-card-bp: calc(($contact-card-max-width * 2) + ($component-side-padding-mobile * 2) + $contact-card-gap);

.contact-card-listing--container {
align-items: flex-start;
column-gap: $contact-card-gap;
display: flex;
flex-direction: column;
flex-direction: row;
flex-wrap: wrap;

@include breakpoint($breakpoint-s) {
flex-direction: row;
}

.contact-card {
margin-bottom: $spacing-triple;

&:not(:last-of-type) {
padding-right: $spacing-and-half;
@include breakpoint($contact-card-bp) {
max-width: $contact-card-max-width;
}

@include breakpoint($breakpoint-s) {
min-width: fit-content;
max-width: none;
min-width: min-content;
width: 25%;
}
}
Expand Down
84 changes: 41 additions & 43 deletions src/scss/06_components/paragraphs/_contact-card.scss
Original file line number Diff line number Diff line change
@@ -1,78 +1,76 @@
$contact-card-image-size-desktop: 200px;
$contact-card-image-size-mobile: 100px;
$contact-card-information-container-width: $contact-card-image-size-desktop;
$contact-card-image-size: 200px;
$contact-card-color-line-width: 4px;
$contact-card-max-width: $contact-card-image-size;

.contact-card {
display: flex;
}

.contact-card--with-image {
@include breakpoint($breakpoint-s) {
flex-direction: column;
}
flex-direction: column;
}

.contact-card--information-container {
@include breakpoint($breakpoint-s) {
max-width: $contact-card-information-container-width;
.contact-card__image-container {
margin-bottom: $spacing;
margin-right: 0;

img {
height: $contact-card-image-size;
width: $contact-card-image-size;
}
}

.contact-card--person-social-media {
display: flex;

.hel-icon {
height: $spacing-and-half;
margin-right: $spacing-half;
width: $spacing-and-half;
}
.contact-card__person-phone-number a:not(:last-of-type)::after {
content: ',';
margin-right: 2px;
}

.contact-card--image-container {
margin-bottom: $spacing;
margin-right: $spacing;
.contact-card__person-information {
@include font(small);
word-wrap: break-word;
hyphens: auto;
margin-bottom: $spacing-half;
overflow-wrap: break-word;

@include breakpoint($breakpoint-s) {
margin-right: 0;
}

img {
height: $contact-card-image-size-mobile;
width: $contact-card-image-size-mobile;

@include breakpoint($breakpoint-s) {
height: $contact-card-image-size-desktop;
width: $contact-card-image-size-desktop;
}
min-width: $contact-card-max-width;
}
}
.contact-card--color-line .contact-card__person-information {
min-width: calc($contact-card-image-size - $spacing-and-half - $spacing-quarter);
}

.contact-card--person-name {
margin-top: 0;

.contact-card__person-name {
@include font('h5');
margin-top: 0;
}

.contact-card--person-phone-number a:not(:last-of-type)::after {
content: ',';
margin-right: 2px;
.contact-card__person-email {
word-break: break-all;
}

.contact-card--person-email {
word-break: break-all;
.contact-card__person-social-media {
display: flex;
margin-bottom: $spacing;
margin-top: $spacing;

.hel-icon {
height: $spacing-and-half;
margin-right: $spacing-half;
width: $spacing-and-half;
}
}

.contact-card--person-information {
margin-bottom: $spacing-half;
* + .contact-card__person-description {
margin-top: $spacing;
}

.contact-card--color-line {
.contact-card__color-line {
background-color: var(--hdbt-color-palette--primary);
margin-right: $spacing-and-half;
min-width: $contact-card-color-line-width;
}

.contact-card--person-description {
.contact-card__person-description {
color: var(--color-black-60);
}
30 changes: 15 additions & 15 deletions templates/paragraphs/paragraph--contact-card.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,48 @@
{%
set classes = [
'contact-card',
content.field_contact_image|render ? 'contact-card--with-image'
content.field_contact_image|render ? 'contact-card--with-image' : 'contact-card--color-line'
]
%}


{% block paragraph %}
<div{{ attributes.addClass(classes) }}>
<div class="{% if contact_image|render %}contact-card--image-container{% else %}contact-card--color-line{% endif %}">
<div class="{% if contact_image|render %}contact-card__image-container{% else %}contact-card__color-line{% endif %}">
{{ contact_image }}
</div>
<div class="contact-card--information-container">
{% if content.field_contact_name|render %}
<{{ heading_level }} class="contact-card--person-information contact-card--person-name">
<div class="contact-card__information-container">
{% if content.field_contact_name|render|striptags|trim %}
<{{ heading_level }} class="contact-card__person-information contact-card__person-name">
<div class="label visually-hidden">{{ 'Name'|t({}, {'context': 'Contact card paragraph field labels'}) }}</div>
{{ content.field_contact_name }}
</{{ heading_level }}>
{% endif %}
{% if content.field_contact_title|render %}
<div class="contact-card--person-information">
{% if content.field_contact_title|render|striptags|trim %}
<div class="contact-card__person-information">
<div class="label visually-hidden">{{ 'Title'|t({}, {'context': 'Contact card paragraph field labels'}) }}</div>
{{ content.field_contact_title }}
</div>
{% endif %}
{% if content.field_phone_number|render %}
<div class="contact-card--person-information contact-card--person-phone-number">
{% if content.field_phone_number|render|striptags|trim %}
<div class="contact-card__person-information contact-card__person-phone-number">
<div class="label visually-hidden">{{ 'Phone number'|t({}, {'context': 'Contact card paragraph field labels'}) }}</div>
{{ content.field_phone_number }}
</div>
{% endif %}
{% if content.field_email|render %}
<div class="contact-card--person-information contact-card--person-email">
{% if content.field_email|render|striptags|trim %}
<div class="contact-card__person-information contact-card__person-email">
<div class="label visually-hidden">{{ 'Email'|t({}, {'context': 'Contact card paragraph field labels'}) }}</div>
{{ content.field_email }}
</div>
{% endif %}
{% if content.field_contact_social_media|render %}
<div class="contact-card--person-information contact-card--person-social-media">
{% if content.field_contact_social_media|render|striptags|trim %}
<div class="contact-card__person-information contact-card__person-social-media">
{{ content.field_contact_social_media }}
</div>
{% endif %}
{% if content.field_contact_description|render %}
<div class="contact-card--person-information contact-card--person-description">
{% if content.field_contact_description|render|striptags|trim %}
<div class="contact-card__person-information contact-card__person-description">
<div class="label visually-hidden">{{ 'Description'|t({}, {'context': 'Contact card paragraph field labels'}) }}</div>
{{ content.field_contact_description }}
</div>
Expand Down
Loading