Skip to content

Commit

Permalink
EWPP-1822: Remove usage of custom css class and apply some code impro…
Browse files Browse the repository at this point in the history
…vements.
  • Loading branch information
sergepavle committed Jan 20, 2022
1 parent fa87df3 commit ebcda85
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 19 deletions.
3 changes: 1 addition & 2 deletions modules/oe_theme_content_event/js/event_livestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
attach: function attach(context) {
setTimeout(function () {
Array.prototype.forEach.call(document.querySelectorAll('[data-livestream-element]'), function (element) {
element.classList.remove('hidden');
element.classList.remove('ecl-link--hidden');
element.classList.remove('ecl-u-d-none');
});
}, drupalSettings.oe_theme_content_event.livestream_starttime_timestamp - Date.now())
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ public static function create(ContainerInterface $container, array $configuratio
/**
* Is current day.
*
* @param int $start_timestamp
* @param int $timestamp
* The timestamp of start date.
*
* @return bool
* True if timestamp is within current day.
*/
protected function isCurrentDay(int $start_timestamp): bool {
protected function isCurrentDay(int $timestamp): bool {
$current_date = $this->dateFormatter->format($this->requestDateTime->getTimestamp(), 'custom', 'Ymd');
$start_day = $this->dateFormatter->format($start_timestamp, 'custom', 'Ymd');
$start_day = $this->dateFormatter->format($timestamp, 'custom', 'Ymd');
return $current_date === $start_day;
}

Expand All @@ -80,15 +80,15 @@ protected function isCurrentDay(int $start_timestamp): bool {
*
* @param array $build
* The render array.
* @param int $start_timestamp
* @param int $timestamp
* The timestamp of start date.
*/
protected function addLivestreamDisclosure(array &$build, int $start_timestamp): void {
protected function addLivestreamDisclosure(array &$build, int $timestamp): void {
$build['#attached'] = [
'library' => 'oe_theme_content_event/livestream_link_disclosure',
'drupalSettings' => [
'oe_theme_content_event' => [
'livestream_starttime_timestamp' => $start_timestamp * 1000,
'livestream_starttime_timestamp' => $timestamp * 1000,
],
],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
<div>{{ date }}</div>
{% endif %}
{% if label is not empty %}
{#
Use custom 'ecl-link--hidden' class in case we need to hide the link.
Usage of 'hidden' attribute is restricted by priorities of CSS rule.
Built-in classes of 'link' component have higher priority and override display rules.
#}
{% include '@ecl-twig/link' with {
link: {
type: 'standalone',
Expand All @@ -30,6 +25,6 @@
name: 'data-livestream-element'
},
],
extra_classes: hide_link ? 'ecl-link--hidden',
extra_classes: hide_link ? 'ecl-u-d-none',
} %}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
#}
{% if description is not empty %}
<div {% if hidden %}class="hidden"{% endif %} data-livestream-element="true">
<div {% if hidden %}class="ecl-u-d-none"{% endif %} data-livestream-element="true">
<h3 class="ecl-u-type-heading-3">{{ 'Livestream'|t }}</h3>
{{ description }}
<a href="{{ url }}" class="ecl-u-mt-l ecl-u-mb-l ecl-link ecl-link--cta ecl-u-d-inline-block">{{ label }}</a>
Expand Down
4 changes: 0 additions & 4 deletions sass/components/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,3 @@ a {
.ecl-u-shadow-none {
box-shadow: none!important;
}

.ecl-link--hidden {
display: none;
}

0 comments on commit ebcda85

Please sign in to comment.