Skip to content

Commit

Permalink
feat: add subscription indicator to resources (resolves #268) (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ned Zimmerman authored Mar 25, 2020
1 parent 15cbd9c commit f39f099
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/assets/styles/components/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@
}
}

.card__meta.card__subscription {
color: var(--red-500);

svg {
color: inherit;
}
}

.card--resource {
@include card($red-400, var(--dark-mint-500), false);

Expand Down
8 changes: 8 additions & 0 deletions src/assets/styles/layouts/_resource.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
color: var(--grey-500);
}

.resource__meta.resource__subscription {
color: var(--red-500);

svg {
color: inherit;
}
}

h1 + .resource__meta {
margin-top: rem(24);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/layouts/archive/archive.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ for ( let i = 0; i < resourceCount; i++ ) {
topicCount: faker.random.number( { min: 3, max: 7 } ),
href: 'resource',
standAlone: true,
requiresSubscription: i % 2 ? true : false
} );
}

Expand Down
3 changes: 2 additions & 1 deletion src/components/layouts/favorites/favorites.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ for ( let i = 0; i < resourceCount; i++ ) {
topicCount: faker.random.number( { min: 3, max: 7 } ),
href: 'resource',
standAlone: true,
showRemoveButton: true
showRemoveButton: true,
requiresSubscription: i % 2 ? true : false
} );
}

Expand Down
3 changes: 2 additions & 1 deletion src/components/layouts/resource/resource.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
locality: 'Canada',
language: 'English',
date: 2019,
byline: 'Some Co-operator'
byline: 'Some Co-operator',
requiresSubscription: true
}
};
3 changes: 3 additions & 0 deletions src/components/layouts/resource/resource.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<article class="resource">
<div class="page-header resource__header">
<h1>{{ title }}</h1>
{% if requiresSubscription %}
<p class="resource__meta resource__subscription">{% render '@svg', {svg:'lock'}, true %} <span aria-hidden="true">Subscription required</span><span class="screen-reader-text">Subscription required to access this resource</span></p>
{% endif %}
{% if byline %}
<div class="resource__meta resource__byline">{% render '@svg', {svg:'author'}, true %} By {{ byline | safe }}</div>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ for ( let i = 0; i < resourceCount; i++ ) {
topicCount: faker.random.number( { min: 3, max: 7 } ),
href: 'resource',
standAlone: true,
requiresSubscription: i % 2 ? true : false
} );
}

Expand Down
3 changes: 3 additions & 0 deletions src/components/molecules/card/card--resource.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<h3 class="card__title" >
<a class="card__link" href="{{ href }}">{{ title | safe }}</a>
</h3>
{% if requiresSubscription %}
<p class="card__meta card__subscription">{% render '@svg', {svg:'lock'}, true %} <span aria-hidden="true">Subscription required</span><span class="screen-reader-text">Subscription required to access this resource</span></p>
{% endif %}
{% if byline %}
<p class="card__byline">{% render '@svg', {svg:'author'}, true %} By {{ byline | safe }}</p>
{% endif %}
Expand Down
3 changes: 2 additions & 1 deletion src/components/molecules/card/card.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module.exports = {
href: 'resource',
favorite: true,
language: 'English',
showRemoveButton: false
showRemoveButton: false,
requiresSubscription: true
}
},
{
Expand Down

0 comments on commit f39f099

Please sign in to comment.