Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@11ty/eleventy": "2.0.1",
"@11ty/eleventy-img": "3.1.0",
"@11ty/eleventy-navigation": "0.3.5",
"@zachleat/filter-container": "3.0.4",
"@zachleat/filter-container": "greatislander/filter-container#feat/paginated-results",
"infusion": "4.6.0",
"modern-css-reset": "1.4.0",
"wicg-inert": "3.1.2"
Expand Down
106 changes: 82 additions & 24 deletions src/_includes/layouts/resources.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,89 @@
{% set bodyClass = "resources" %}

{% block content %}
{% if resources.length %}
{% if collections.resources.length %}
<div class="[ wrapper ]">
<div class="[ flow ] [ flow-md ]">
{% for item in resources %}
<article class="[ resource ] [ two:three ]">
<div class="[ two:three__two ]">
{% if item.data.metaImage %}
{% image item.data.metaImage, item.data.metaImageAlt, "570", "380" %}
{% else %}
{% image "/assets/media/design-activity_hua7f35ba46080e3314a834735ed95f389_2828843_1000x0_resize_q75_box.jpg", "", "570", "380" %}
{% endif %}
</div>
<div class="[ two:three__three ] [ flow ]">
<h2><a href="{{ item.url }}">{{ item.data.title }}</a></h2>
<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>
{% if item.data.description %}
<p>{{ item.data.description | safe }}</p>
{% endif %}
</div>
</article>
{% endfor %}
</div>
{% if pagination.pages.length > 1 %}
{% include "partials/components/pagination.njk" %}
{% endif %}
<div id="resources">
<div class="[ flow-lg ]">
<filter-container class="[ filter ] [ flow ]" oninit data-paginate-results="10">
<h2 class="[ h3 ]">Filter Resources</h2>
<form class="[ filters ]">
<label class="[ label ]" for="type">
Type:
<select class="[ select ]" name="type" id="type" data-filter-key="type">
<option value="">Any Type</option>
{% for type in resourceTags.types %}
<option value="{{ type }}" data-slug="{{ type | slugify }}">{{ type }}</option>
{% endfor %}
</select>
</label>
{# <button type="reset" class="[ button ] [ button--sm ]" id="reset">{% include "svg/reset.svg" %}Clear Filters</button> #}
</form>
<div class="[ alert ]" role="alert" aria-live="polite" data-filter-results="matching resource./matching resources.">
{{ collections.resources.length }} matching resources.</p>
</div>
<div class="[ visually-hidden ]" role="alert" aria-live="polite" data-pagination-results="showing page"></div>

<div class="[ flow ] [ flow-md ]">
{% for item in collections.resources %}
<article class="[ resource ] [ two:three ]" data-filter-type="{{ item.data.type }}">
<div class="[ two:three__two ]">
{% if item.data.metaImage %}
{% image item.data.metaImage, item.data.metaImageAlt, "570", "380" %}
{% else %}
{% image "/assets/media/design-activity_hua7f35ba46080e3314a834735ed95f389_2828843_1000x0_resize_q75_box.jpg", "", "570", "380" %}
{% endif %}
</div>
<div class="[ two:three__three ] [ flow ]">
<h2><a href="{{ item.url }}">{{ item.data.title }}</a></h2>
<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>
{% if item.data.description %}
<p>{{ item.data.description | safe }}</p>
{% endif %}
</div>
</article>
{% endfor %}
</div>
<nav class="[ pagination ]" aria-label="pagination" data-pagination-navigation>
<ul role="list">
<li hidden><a rel="prev"><span aria-hidden="true">&larr;</span><span class="[ visually-hidden ]">previous</span></a></li>
{%- for i in range(0, collections.resources.length / 5) %}
<li><a data-page="{{ i + 1 }}" href="{{ page.url }}?page={{ i + 1 }}"{% if i === 0 %} aria-current="page"{% endif %}>{{ loop.index }}</a></li>
{%- endfor %}
<li><a rel="next" href="{{ page.url }}?page=2"><span class="[ visually-hidden ]">next</span><span aria-hidden="true">&rarr;</span></a></li>
<template data-pagination-link>
<li><a data-page href=""></a></li>
</template>
</ul>
</nav>
</filter-container>
</div>
</div>
<noscript>
<div class="[ flow ] [ flow-md ]">
{% for item in resources %}
<article class="[ resource ] [ two:three ]">
<div class="[ two:three__two ]">
{% if item.data.metaImage %}
{% image item.data.metaImage, item.data.metaImageAlt, "570", "380" %}
{% else %}
{% image "/assets/media/design-activity_hua7f35ba46080e3314a834735ed95f389_2828843_1000x0_resize_q75_box.jpg", "", "570", "380" %}
{% endif %}
</div>
<div class="[ two:three__three ] [ flow ]">
<h2><a href="{{ item.url }}">{{ item.data.title }}</a></h2>
<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>
{% if item.data.description %}
<p>{{ item.data.description | safe }}</p>
{% endif %}
</div>
</article>
{% endfor %}
</div>
{% if pagination.pages.length > 1 %}
{% include "partials/components/pagination.njk" %}
{% endif %}
</noscript>
</div>
{% endif %}
{% endblock %}
6 changes: 5 additions & 1 deletion src/assets/styles/pages/_resources.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
// This file contains styles that are specific to the resources page.
// -----------------------------------------------------------------------------

.no-js .resources #resources {
display: none;
}

.resources .resource picture img {
border-inline-start: var(--space-lg) solid var(--color-orange-75);
}

.resources .resource + .resource {
.resources .resource:not([class*="--hide"]) ~ .resource {
border-block-start: var(--border-hairline) solid var(--color-black-05);
margin-block-start: var(--space-lg);
padding-block-start: var(--space-lg);
Expand Down
3 changes: 1 addition & 2 deletions src/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ eleventyNavigation:
parent: Learn
key: Accessible Coding Resources
order: 1
permalink: /learn/resources/{% if pagination.pageNumber > 0 %}page/{{
pagination.pageNumber + 1 }}/{% endif %}
permalink: /learn/resources/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber + 1 }}/{% endif %}
pagination:
data: collections.resources
size: 10
Expand Down