|
3 | 3 | {% set bodyClass = "resources" %} |
4 | 4 |
|
5 | 5 | {% block content %} |
6 | | -{% if resources.length %} |
| 6 | +{% if collections.resources.length %} |
7 | 7 | <div class="[ wrapper ]"> |
8 | | - <div class="[ flow ] [ flow-md ]"> |
9 | | - {% for item in resources %} |
10 | | - <article class="[ resource ] [ two:three ]"> |
11 | | - <div class="[ two:three__two ]"> |
12 | | - {% if item.data.metaImage %} |
13 | | - {% image item.data.metaImage, item.data.metaImageAlt, "570", "380" %} |
14 | | - {% else %} |
15 | | - {% image "/assets/media/design-activity_hua7f35ba46080e3314a834735ed95f389_2828843_1000x0_resize_q75_box.jpg", "", "570", "380" %} |
16 | | - {% endif %} |
17 | | - </div> |
18 | | - <div class="[ two:three__three ] [ flow ]"> |
19 | | - <h2><a href="{{ item.url }}">{{ item.data.title }}</a></h2> |
20 | | - <p class="metadata">{% if item.data.author %}By <span class="[ author ]">{{ item.data.author }}</span> / {% endif %}Posted <time datetime="{{ item.data.date | isoDate }}" class="[ dt-published ]">{{ item.data.date | formatDate }}</time></p> |
21 | | - {% if item.data.description %} |
22 | | - <p>{{ item.data.description | safe }}</p> |
23 | | - {% endif %} |
24 | | - </div> |
25 | | - </article> |
26 | | - {% endfor %} |
27 | | - </div> |
28 | | - {% if pagination.pages.length > 1 %} |
29 | | - {% include "partials/components/pagination.njk" %} |
30 | | - {% endif %} |
| 8 | + <div id="resources"> |
| 9 | + <div class="[ flow-lg ]"> |
| 10 | + <filter-container class="[ filter ] [ flow ]" oninit data-paginate-results="10"> |
| 11 | + <h2 class="[ h3 ]">Filter Resources</h2> |
| 12 | + <form class="[ filters ]"> |
| 13 | + <label class="[ label ]" for="type"> |
| 14 | + Type: |
| 15 | + <select class="[ select ]" name="type" id="type" data-filter-key="type"> |
| 16 | + <option value="">Any Type</option> |
| 17 | + {% for type in resourceTags.types %} |
| 18 | + <option value="{{ type }}" data-slug="{{ type | slugify }}">{{ type }}</option> |
| 19 | + {% endfor %} |
| 20 | + </select> |
| 21 | + </label> |
| 22 | + {# <button type="reset" class="[ button ] [ button--sm ]" id="reset">{% include "svg/reset.svg" %}Clear Filters</button> #} |
| 23 | + </form> |
| 24 | + <div class="[ alert ]" role="alert" aria-live="polite" data-filter-results="matching resource./matching resources."> |
| 25 | + {{ collections.resources.length }} matching resources.</p> |
| 26 | + </div> |
| 27 | + <div class="[ visually-hidden ]" role="alert" aria-live="polite" data-pagination-results="showing page"></div> |
| 28 | + |
| 29 | + <div class="[ flow ] [ flow-md ]"> |
| 30 | + {% for item in collections.resources %} |
| 31 | + <article class="[ resource ] [ two:three ]" data-filter-type="{{ item.data.type }}"> |
| 32 | + <div class="[ two:three__two ]"> |
| 33 | + {% if item.data.metaImage %} |
| 34 | + {% image item.data.metaImage, item.data.metaImageAlt, "570", "380" %} |
| 35 | + {% else %} |
| 36 | + {% image "/assets/media/design-activity_hua7f35ba46080e3314a834735ed95f389_2828843_1000x0_resize_q75_box.jpg", "", "570", "380" %} |
| 37 | + {% endif %} |
| 38 | + </div> |
| 39 | + <div class="[ two:three__three ] [ flow ]"> |
| 40 | + <h2><a href="{{ item.url }}">{{ item.data.title }}</a></h2> |
| 41 | + <p class="metadata">{% if item.data.author %}By <span class="[ author ]">{{ item.data.author }}</span> / {% endif %}Posted <time datetime="{{ item.data.date | isoDate }}" class="[ dt-published ]">{{ item.data.date | formatDate }}</time></p> |
| 42 | + {% if item.data.description %} |
| 43 | + <p>{{ item.data.description | safe }}</p> |
| 44 | + {% endif %} |
| 45 | + </div> |
| 46 | + </article> |
| 47 | + {% endfor %} |
| 48 | + </div> |
| 49 | + <nav class="[ pagination ]" aria-label="pagination" data-pagination-navigation> |
| 50 | + <ul role="list"> |
| 51 | + <li hidden><a rel="prev"><span aria-hidden="true">←</span><span class="[ visually-hidden ]">previous</span></a></li> |
| 52 | + {%- for i in range(0, collections.resources.length / 5) %} |
| 53 | + <li><a data-page="{{ i + 1 }}" href="{{ page.url }}?page={{ i + 1 }}"{% if i === 0 %} aria-current="page"{% endif %}>{{ loop.index }}</a></li> |
| 54 | + {%- endfor %} |
| 55 | + <li><a rel="next" href="{{ page.url }}?page=2"><span class="[ visually-hidden ]">next</span><span aria-hidden="true">→</span></a></li> |
| 56 | + <template data-pagination-link> |
| 57 | + <li><a data-page href=""></a></li> |
| 58 | + </template> |
| 59 | + </ul> |
| 60 | + </nav> |
| 61 | + </filter-container> |
| 62 | + </div> |
| 63 | + </div> |
| 64 | + <noscript> |
| 65 | + <div class="[ flow ] [ flow-md ]"> |
| 66 | + {% for item in resources %} |
| 67 | + <article class="[ resource ] [ two:three ]"> |
| 68 | + <div class="[ two:three__two ]"> |
| 69 | + {% if item.data.metaImage %} |
| 70 | + {% image item.data.metaImage, item.data.metaImageAlt, "570", "380" %} |
| 71 | + {% else %} |
| 72 | + {% image "/assets/media/design-activity_hua7f35ba46080e3314a834735ed95f389_2828843_1000x0_resize_q75_box.jpg", "", "570", "380" %} |
| 73 | + {% endif %} |
| 74 | + </div> |
| 75 | + <div class="[ two:three__three ] [ flow ]"> |
| 76 | + <h2><a href="{{ item.url }}">{{ item.data.title }}</a></h2> |
| 77 | + <p class="metadata">{% if item.data.author %}By <span class="[ author ]">{{ item.data.author }}</span> / {% endif %}Posted <time datetime="{{ item.data.date | isoDate }}" class="[ dt-published ]">{{ item.data.date | formatDate }}</time></p> |
| 78 | + {% if item.data.description %} |
| 79 | + <p>{{ item.data.description | safe }}</p> |
| 80 | + {% endif %} |
| 81 | + </div> |
| 82 | + </article> |
| 83 | + {% endfor %} |
| 84 | + </div> |
| 85 | + {% if pagination.pages.length > 1 %} |
| 86 | + {% include "partials/components/pagination.njk" %} |
| 87 | + {% endif %} |
| 88 | + </noscript> |
31 | 89 | </div> |
32 | 90 | {% endif %} |
33 | 91 | {% endblock %} |
0 commit comments