Created
July 13, 2020 13:34
-
-
Save cherrykoda/2a9761958e71cd00df847cb58ad08fe6 to your computer and use it in GitHub Desktop.
[Medium] Macros v. Partials - Related Resources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<div class="cards"> | |
{% for activity in relatedActivities %} | |
{% set activityLink = _action.determineResourceLink(activity) %} | |
<a href="{{ activityLink }}" class="card -icon {% if loop.length < 4 %}-tight{% endif %}"> | |
{% set activityImage = activity.resourceThumbnail|length ? activity.resourceThumbnail[0] : null %} | |
<div class="card__icon lazyload" data-bgset="{{ activityImage ? activityImage.url('thumbnail') : '/images/placeholder.jpg' }}" role="img" title="{{ activityImage ? activityImage.imageAltText : '' }}"></div> | |
<div class="card__content"> | |
<p class="card__topic topic">{{ activity.resourceTopics.one }}</p> | |
<h3 class="card__headline">{{ activity.title }}</h3> | |
<p class="card__meta meta"> | |
{% if activity.resourceAges|length == 4 %} | |
<span class="meta__age">All Ages</span> | |
{% else %} | |
{% for age in activity.resourceAges.all %} | |
<span class="meta__age">{{ age }}{{ loop.last ? '' : ', ' }}</span> | |
{% endfor %} | |
{% endif %} | |
</p> | |
<div class="card__action"> | |
{{ _action.createResourceAction(activity) }} | |
</div> | |
</div> | |
</a> | |
{% endfor %} | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment