Skip to content

Commit

Permalink
make event tag a component
Browse files Browse the repository at this point in the history
  • Loading branch information
dakur committed Jan 24, 2025
1 parent 5065764 commit cfac67f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
19 changes: 14 additions & 5 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,7 @@ function hb_event(EventDC $event, bool $lazyLoading = true, bool $smaller = fals

<?php if ($event->tags): ?>
<div class="hb-event__tags">
<?php foreach ($event->tags as $tag): ?>
<span class="hb-event__tag eventTag">
<?php echo $tag ?>
</span>
<?php endforeach; ?>
<?php hb_tags($event->tags, 'hb-event__tag') ?>
</div>
<?php endif; ?>

Expand Down Expand Up @@ -526,4 +522,17 @@ function hb_eventLabels(array $labels)
<?php endforeach; ?>
</div>
<?php
}


/** @param string[] $tags */
function hb_tags(array $tags, ?string $className)
{
foreach ($tags as $tag):
?>
<span class="<?php echo $className !== null ? $className + ' ' : ''; ?>eventTag">
<?php echo $tag ?>
</span>
<?php
endforeach;
}
6 changes: 1 addition & 5 deletions template-parts/content/content-akce.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,7 @@ class="registration__actionButton action action--primary action--lg"

<?php if ($event->tags): ?>
<div class="hb-d-f hb-jc-c">
<?php foreach ($event->tags as $tag): ?>
<span class="detail__tag eventTag">
<?php echo $tag ?>
</span>
<?php endforeach; ?>
<?php hb_tags($event->tags, 'detail__tag') ?>
</div>
<?php endif; ?>

Expand Down

0 comments on commit cfac67f

Please sign in to comment.