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-10259: Curated event list #1091

Merged
merged 13 commits into from
Oct 22, 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
4 changes: 2 additions & 2 deletions dist/css/styles.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/scss/06_components/__index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
@import 'tags';
@import 'throbber';
@import 'editorially';
@import 'linkedevents-event';
73 changes: 73 additions & 0 deletions src/scss/06_components/_linkedevents-event.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// @todo: Move these styles to generice teaser file
// https://helsinkisolutionoffice.atlassian.net/browse/UHF-10868
.linkedevents-event {
display: flex;
height: 100%;

@include breakpoint($breakpoint-m) {
flex-direction: column;
padding-bottom: 0;
}
}

.linkedevents-event__title {
@include font(h5);
margin-bottom: $spacing-half;
margin-top: 0;

@include breakpoint($breakpoint-l) {
@include font(h4);
}
}

.linkedevents-event__title a::after {
bottom: 0;
content: '';
left: 0;
position: absolute;
right: 0;
top: 0;
}

.linkedevents-event__text-container {
display: flex;
flex-direction: column;
height: 100%;
padding-inline-start: $spacing;
width: 60%;

@include breakpoint($breakpoint-m) {
padding: $spacing 0 0 0;
width: unset;
}

[dir='rtl'] & {
padding-left: 0;
padding-right: $spacing;

@include breakpoint($breakpoint-m) {
padding-left: 0;
padding-right: 0;
}
}
}

.linkedevents-event__img {
position: relative;
width: 40%;

@include breakpoint($breakpoint-m) {
width: unset;
}

img {
display: block;
height: auto;
width: 100%;
}
}

.linkedevents-event__date-container {
@include font(small);
color: $color-black-60
}
10 changes: 6 additions & 4 deletions src/scss/06_components/pages/_news-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,18 @@
}

// Latest news block variant.
// @todo: move medium teaser styles to generic teaser
// https://helsinkisolutionoffice.atlassian.net/browse/UHF-10868
.news-listing--latest-medium-teasers {
margin-bottom: 0;
padding-inline-start: 0; // User agent stylesheet override
padding-right: 0;

@include breakpoint($breakpoint-m) {
grid-column-gap: $spacing-and-half;
grid-row-gap: $spacing-double;
column-gap: $spacing-and-half;
display: grid;
grid-template-columns: repeat(2, 1fr);
row-gap: $spacing-double;
}

.news-listing__item {
Expand Down Expand Up @@ -219,13 +221,13 @@
}

.news-listing--card-teasers {
grid-gap: 0;
display: grid;
gap: 0;
list-style: none;
padding-left: 0;

@include breakpoint($breakpoint-m) {
grid-column-gap: $spacing-and-half;
column-gap: $spacing-and-half;
grid-template-columns: repeat(3, 1fr);
}

Expand Down
1 change: 1 addition & 0 deletions src/scss/06_components/paragraphs/__index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@import 'contact-card';
@import 'contact-card-listing';
@import 'content-cards';
@import 'curated-event-list';
@import 'district-and-project-search';
@import 'event-list';
@import 'hearings';
Expand Down
31 changes: 31 additions & 0 deletions src/scss/06_components/paragraphs/_curated-event-list.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.curated-event-list__events {
display: grid;
gap: 0;
list-style: none;
padding-left: 0;

@include breakpoint($breakpoint-m) {
column-gap: $spacing-and-half;
grid-template-columns: repeat(3, 1fr);
}
}

.curated-event-list__event + .curated-event-list__event {
margin-top: $spacing-double;

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

.curated-event-list__empty-message__container {
margin-bottom: $spacing-and-half;
}

.curated-event-list__empty-message {
@include font(h4);
}

.curated-event-list__event {
position: relative;
}
43 changes: 43 additions & 0 deletions templates/content/external-entity--linkedevents-event.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{# @todo Use a general component to create the card-teaser html #}
{# https://helsinkisolutionoffice.atlassian.net/browse/UHF-10868 #}
<div class="linkedevents-event">
<div class="linkedevents-event__img">
{{ content.main_image }}
</div>
<div class="linkedevents-event__text-container">
<h3 class="linkedevents-event__title">
{{ content.external_link }}
</h3>
<div class="linkedevents-event__date-container">
{% set is_multidate = start_timestamp|date('Y-m-d') != end_timestamp|date('Y-m-d') %}
{% set same_year = start_timestamp|date('Y') == end_timestamp|date('Y') %}
{% set html_start = start_timestamp|format_date('custom', 'Y-m-d') ~ 'T' ~ start_timestamp|format_date('custom', 'H:i') %}
{% set html_end = end_timestamp|format_date('custom', 'Y-m-d') ~ 'T' ~ end_timestamp|format_date('custom', 'H:i') %}
{% if is_multidate and not same_year %}
<time datetime="{{ html_start }}">
{{ start_timestamp|date('d.m.Y') }}
</time>
<time datetime="{{ html_end }}">
{{ end_timestamp|date('d.m.Y') }}
</time>
{% elseif is_multidate %}
<time datetime="{{ html_start }}">
{{ start_timestamp|date('d.m.') }}
</time>
<time datetime="{{ html_end }}">
{{ end_timestamp|date('d.m.Y') }}
</time>
{% else %}
<time datetime="{{ html_start }}">
{{ start_timestamp|format_date('publication_date_format') }}
</time>
<time datetime="{{ html_end }}">
{{ end_timestamp|format_date('custom', 'H:i') }}
</time>
{% endif %}
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{# @todo Use a general component to create the card-teaser html #}
{# https://helsinkisolutionoffice.atlassian.net/browse/UHF-10868 #}
<div class="news-listing__content news-listing__card-teaser">
{# Main image #}
<div class="news-listing__img">
Expand Down
38 changes: 38 additions & 0 deletions templates/paragraphs/paragraph--curated-event-list.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% block paragraph %}
{% embed "@hdbt/misc/component.twig" with
{
component_classes: [
'component--full-width',
'component--curated-event-list',
],
component_title_level: 'h2',
component_title: 'Recommended events'|trans({}, {'context': 'Curated event list title'}),
}
%}
{% block component_content %}
<div class="curated-event-list">
{% if content.future_or_ongoing is empty %}
<div class="curated-event-list__empty-message__container">
<span class="curated-event-list__empty-message">
{{ 'Recommended events were not found'|t({}, {'context': 'Curated events list empty message'}) }}
</span>
</div>
{% else %}
<ul class="curated-event-list__events">
{% for event in content.future_or_ongoing %}
<li class="curated-event-list__event">
{{ event }}
</li>
{% endfor %}
</ul>
{% endif %}
{% include '@hdbt/navigation/link-button.html.twig' with {
label: content.field_all_events_link.0['#title'],
open_in_a_new_window: content.field_all_events_link.0.options.target_new,
type: 'primary',
url: content.field_all_events_link.0['#url'],
} %}
</div>
{% endblock %}
{% endembed %}
{% endblock %}
8 changes: 8 additions & 0 deletions translations/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,14 @@ msgctxt "The helper text before the news article changed timestamp"
msgid "updated"
msgstr "päivitetty"

msgctxt "Curated event list title"
msgid "Recommended events"
msgstr "Suositellut tapahtumat"

msgctxt "Curated events list empty message"
msgid "Recommended events were not found"
msgstr "Suositeltuja tapahtumia ei löytynyt."

msgctxt "React & Share cookie compliance"
msgid "Would you like to give feedback on this page?"
msgstr "Haluatko antaa meille palautetta tästä sivusta?"
Expand Down