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-8689: Captions for illustrations on special pages #1138

Merged
merged 6 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

1 change: 1 addition & 0 deletions src/scss/05_objects/__index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
@import 'unpublished-content-flag';
@import 'user-edited-content';
@import 'main-image';
@import 'special-page-illustration';
32 changes: 32 additions & 0 deletions src/scss/05_objects/_special-page-illustration.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.special-page__illustration-container {
--illustration-large-width: 379px;
align-items: center;
display: flex;
flex-direction: column;
justify-content: flex-start;

@include breakpoint($breakpoint-m) {
max-width: 100%;
padding-left: $spacing-sextuple;
width: 50%;
}
}

.special-page__illustration {
display: block;
height: auto;
margin-bottom: $spacing;
margin-top: $spacing-triple;
max-width: var(--illustration-large-width);
width: 100%;

@include breakpoint($breakpoint-m) {
margin-left: 0;
margin-top: 0;
}
}

.special-page__illustration__caption {
max-width: var(--illustration-large-width);
width: 100%;
}
21 changes: 1 addition & 20 deletions src/scss/06_components/layout/_error-pages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,10 @@ body:has(.error-page__title) {
// }
}

.error-page__illustration-container {
.special-page__illustration-container--error-page {
@include breakpoint($breakpoint-m) {
align-items: flex-start;
display: flex;
justify-content: center;
padding-left: $spacing-triple;
padding-right: $spacing-triple;
padding-top: $spacing-sextuple;
width: 50%;
}
}

.error-page__illustration {
display: block;
height: auto;
margin-left: $spacing-double;
margin-top: $spacing-triple;
width: 264px;

@include breakpoint($breakpoint-m) {
margin-left: 0;
margin-top: 0;
max-width: 100%;
width: 379px;
}
}
27 changes: 8 additions & 19 deletions src/scss/06_components/layout/_login-page.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
$illustration-max-width-mobile: 450px;

.user-login-page {
// Background on the error pages needs to be gray because the illustrations disappear to the background if its white.
background-color: $color-silver-medium-light;
Expand Down Expand Up @@ -31,28 +29,19 @@ $illustration-max-width-mobile: 450px;
}
}

.user-login-page__illustration-container {
align-items: center;
display: flex;
.special-page__illustration-container--user-login {
--illustration-large-width: 450px;
justify-content: center;
max-width: 600px; // Match the illustration container with the login form.

@include breakpoint($breakpoint-m) {
padding-left: $spacing-sextuple;
width: 50%;
max-width: unset;
}
}

.user-login-page__illustration {
display: block;
height: auto;
margin-top: $spacing-triple;
max-width: $illustration-max-width-mobile;
width: 100%;

@include breakpoint($breakpoint-m) {
margin-left: 0;
margin-top: 0;
max-width: unset;
.special-page__illustration {
@include breakpoint($breakpoint-m) {
max-width: unset;
}
}
}

Expand Down
25 changes: 8 additions & 17 deletions src/scss/06_components/layout/_maintenance-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,16 @@
}
}

.maintenance-page__illustration-container {
.special-page__illustration-container--maintenance-page {
--illustration-large-width: 350px;
margin-bottom: $spacing-triple;

@include breakpoint($breakpoint-m) {
align-items: flex-start;
display: flex;
justify-content: center;
padding: $spacing-sextuple $spacing-triple;
width: 50%;
--illustration-large-width: 460px;
padding-inline: $spacing-triple;
}
}

.maintenance-page__illustration {
display: block;
height: auto;
margin: $spacing-sextuple auto;
width: 350px;

@include breakpoint($breakpoint-m) {
margin: 0;
max-width: 100%;
width: 460px;
.special-page__illustration {
margin-top: $spacing-sextuple;
}
}
11 changes: 8 additions & 3 deletions templates/layout/maintenance-page.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@

</main>
</div>
<div class="maintenance-page__illustration-container">
<img src="https://hel.fi/etusivu-assets/themes/contrib/hdbt/src/images/illustration_maintenance_mode_page.svg" alt="" class="maintenance-page__illustration" width="379" height="566" />
</div>
{% embed '@hdbt/misc/special-page-illustration.twig' with {
illustration_modifier_class: 'special-page__illustration-container--maintenance-page',
illustration_url: 'https://hel.fi/etusivu-assets/themes/contrib/hdbt/src/images/illustration_maintenance_mode_page.svg',
illustration_width: '394',
illustration_height: '559',
illustration_caption: 'Photo: @photographer'|t({'@photographer': 'Lille Santanen'}, {'context': 'Image photographer'}),
} %}
{% endembed %}
{% endblock container_content %}
{% endembed %}
11 changes: 8 additions & 3 deletions templates/layout/page--401.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
{{ drupal_block('user_login_block') }}
</div>
</div>
<div class="error-page__illustration-container">
<img src="{{ theme_path }}/src/images/illustration_error_page_403_401.svg" alt="" class="error-page__illustration" width="379" height="566" />
</div>
{% embed '@hdbt/misc/special-page-illustration.twig' with {
illustration_modifier_class: 'special-page__illustration-container--error-page',
illustration_url: theme_path ~ '/src/images/illustration_error_page_403_401.svg',
illustration_width: '379',
illustration_height: '566',
illustration_caption: 'Photo: @photographer'|t({'@photographer': 'Lille Santanen'}, {'context': 'Image photographer'}),
} %}
{% endembed %}
{% endblock container_content %}
{% endembed %}
{% endblock page_content %}
Expand Down
11 changes: 8 additions & 3 deletions templates/layout/page--404.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@
{% endset %}
{{ link(feedback_link_title, error_page_feedback_link, link_attributes) }}
</div>
<div class="error-page__illustration-container">
<img src="{{ theme_path }}/src/images/illustration_error_page_404.svg" alt="" class="error-page__illustration" width="379" height="566" />
</div>
{% embed '@hdbt/misc/special-page-illustration.twig' with {
illustration_modifier_class: 'special-page__illustration-container--error-page',
illustration_url: theme_path ~ '/src/images/illustration_error_page_404.svg',
illustration_width: '379',
illustration_height: '566',
illustration_caption: 'Photo: @photographer'|t({'@photographer': 'Lille Santanen'}, {'context': 'Image photographer'}),
} %}
{% endembed %}
{% endblock container_content %}
{% endembed %}
{% endblock page_content %}
Expand Down
9 changes: 6 additions & 3 deletions templates/layout/page--user--login.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
</div>
{{ page.content|without(page_title_block) }}
</div>
<div class="user-login-page__illustration-container">
<img src="{{ theme_path }}/src/images/illustration_user_login_page.svg" alt="" class="user-login-page__illustration"/>
</div>
{% embed '@hdbt/misc/special-page-illustration.twig' with {
illustration_modifier_class: 'special-page__illustration-container--user-login',
illustration_url: theme_path ~ '/src/images/illustration_user_login_page.svg',
illustration_caption: 'Photo: @photographer'|t({'@photographer': 'Lille Santanen'}, {'context': 'Image photographer'}),
} %}
{% endembed %}
{% endblock container_content %}
{% endembed %}
{% endblock page_content %}
Expand Down
23 changes: 23 additions & 0 deletions templates/misc/special-page-illustration.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{#
{% embed '@hdbt/misc/special-page-illustration.twig' with {
illustration_modifier_class: 'special-page__illustration-container--modifier-class',
illustration_url: '/url/to/illustration.svg',
illustration_width: '200',
illustration_height: '500',
illustration_caption: 'Photo: @photographer'|t({'@photographer': 'Petra Photographer'}, {'context': 'Image photographer'}),
} %}
{% endembed %}
#}

<figure class="special-page__illustration-container {{ illustration_modifier_class }}">
<img
src="{{ illustration_url }}"
class="special-page__illustration"
alt
{% if illustration_width %}width="{{ illustration_width }}"{% endif %}
{% if illustration_height %}height="{{ illustration_height }}"{% endif %}
/>
<figcaption class="special-page__illustration__caption">
{{ illustration_caption }}
</figcaption>
</figure>
Loading