1
0
mirror of synced 2025-12-25 20:02:09 -05:00
Files
docs/includes/article-cards.html
Vanessa Yuen b46da8dfc7 Sublanding page all guides section (#16869)
* get link liquid tag to accept variables as param

* new liquid tag `link_as_article_card`

* refactor link liquid tag slightly so we can control what props get rendered

* generalize filterCodeExample to use in all guides section

* pass in `js-filter-card-max` instead of hardcode max

* tweaks and add `data` to CSP for images

* add liquid tag tests

* add some browser tests for card filters

* we still need to rely on `getPathWithLanguage` for hrefs that already have the language code embedded


Co-authored-by: Emily Gould <4822039+emilyistoofunky@users.noreply.github.com>
2021-01-18 12:23:23 +00:00

43 lines
1.7 KiB
HTML

{% assign currentCategory = siteTree[currentLanguage][currentVersion].products[currentProduct].categories[breadcrumbs.category.href] %}
{% assign maxArticles = 9 %}
<div class="container-xl px-3 px-md-6 pt-3 pb-2">
<h2 class="mb-3 font-mktg">{% data ui.product_sublanding.all_guides %}</h2>
<form class="my-2">
<label for="type" class="text-uppercase f6 text-gray d-block">{% data ui.product_sublanding.filters.type %}</label>
<select class="form-select js-filter-card-filter-dropdown f4 text-bold border-0 rounded-0 border-top box-shadow-none pl-0 js-filter-card-filter-dropdown" name="type" aria-label="guide types">
<option value="">{% data ui.product_sublanding.filters.all %}</option>
{% for type in site.data.ui.product_sublanding.guide_types %}
<option value="{{ type[0] }}">{{ type[1] }}</option>
{% endfor %}
</select>
</form>
<div class="d-flex flex-wrap mr-0 mr-md-n6 mr-lg-n8">
{% for article in currentCategory.articles %}
{% assign card_display_class = "" %}
{% if forloop.index > maxArticles %}
{% assign card_display_class = "d-none" %}
{% endif %}
{% capture link_card %}
{% link_as_article_card {{ article[1].href }} %}
{% endcapture %}
{{ link_card | replace: "<display condition>", card_display_class }}
{% endfor %}
<button class="col-12 mt-5 text-center text-bold text-blue btn-link js-filter-card-show-more" data-js-filter-card-max="{{ maxArticles }}">
{% data ui.product_sublanding.load_more %}
</button>
<div class="js-filter-card-no-results d-none py-4 text-center text-gray">
<h4 class="text-normal">{% data ui.product_sublanding.no_result %}</h4>
</div>
</div>
</div>