-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add component and styling for favorites page (#242)
* feat: add component and styles for favorites page (resolves #205) * feat: add align-right and align-left classes * feat: make notifications sticky (resolves #241) * feat: add destructive borderless button variant
- Loading branch information
Ned Zimmerman
authored
Feb 13, 2020
1 parent
4796012
commit 5697816
Showing
11 changed files
with
234 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
.page.page-template-page-favorites .cards .card__wrapper { | ||
display: grid; | ||
gap: rem(20); | ||
grid-template-columns: 100%; | ||
grid-template-rows: 1fr 3rem; | ||
} | ||
|
||
@include breakpoint-up(sm) { | ||
.page.page-template-page-favorites { | ||
.cards { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
|
||
@supports (display: $grid) { | ||
display: grid; | ||
gap: rem(30); | ||
grid-template-columns: 100%; | ||
} | ||
} | ||
|
||
.cards .card__wrapper { | ||
margin-bottom: rem(30); | ||
width: 100%; | ||
|
||
@supports (display: $grid) { | ||
margin-bottom: 0; | ||
} | ||
} | ||
|
||
.card:nth-child(even) { | ||
margin-left: 0; | ||
} | ||
} | ||
} | ||
|
||
@include breakpoint-up(md) { | ||
.page.page-template-page-favorites { | ||
.cards { | ||
@supports (display: $grid) { | ||
grid-template-columns: repeat(2, 1fr); | ||
} | ||
} | ||
|
||
.cards .card__wrapper { | ||
width: calc(50% - #{rem(30)} / 2); | ||
|
||
@supports (display: $grid) { | ||
width: 100%; | ||
} | ||
} | ||
|
||
.card:nth-child(even) { | ||
margin-left: rem(30); | ||
|
||
@supports (display: $grid) { | ||
margin-left: 0; | ||
} | ||
} | ||
|
||
.cards .card__wrapper + .card__wrapper { | ||
margin-top: 0; | ||
} | ||
} | ||
} | ||
|
||
@include breakpoint-up(lg) { | ||
.page.page-template-page-favorites main { | ||
@include grid-column-span(8, 12, 3); | ||
} | ||
} | ||
|
||
@include breakpoint-up(xl) { | ||
.page.page-template-page-favorites main { | ||
@include grid-column-span(8, 16, 4); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,4 @@ | |
@import "layouts/footer"; | ||
@import "layouts/archive"; | ||
@import "layouts/resource"; | ||
@import "layouts/favorites"; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{% if not standAlone %}<div class="spacer"></div>{% endif %} | ||
<button {% if id %}id="{{ id }}" {% endif %}type="button" class="button{% if modifiers %}{% for modifier in modifiers %} button--{{ modifier }}{% endfor %}{% endif %}"> | ||
<button {% if id %}id="{{ id }}" {% endif %}type="button" class="button{% if modifiers %}{% for modifier in modifiers %} button--{{ modifier }}{% endfor %}{% endif %}{% if className %} {{ className }}{% endif %}"> | ||
{% if icon and iconPosition === 'start' %}{% render '@svg', {svg:icon}, true %}{% endif %}<span class="button__label{{ ' screen-reader-text' if labelVisuallyHidden }}">{{ label | safe }}</span>{% if icon and iconPosition === 'end' %}{% render '@svg', {svg:icon}, true %}{% endif %} | ||
</button> |
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
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
84 changes: 84 additions & 0 deletions
84
src/components/03-layouts/05-favorites/favorites.config.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
const faker = require( 'faker' ); | ||
const title = require( 'title' ); | ||
|
||
const formats = [ | ||
{ | ||
label: 'Audio', | ||
svg: 'audio', | ||
}, | ||
{ | ||
label: 'Case Study', | ||
svg: 'case-study', | ||
}, | ||
{ | ||
label: 'Toolkit', | ||
svg: 'toolkit', | ||
}, | ||
{ | ||
label: 'Educational Curriculum', | ||
svg: 'educational-curriculum', | ||
}, | ||
{ | ||
label: 'Video', | ||
svg: 'video', | ||
}, | ||
{ | ||
label: 'Article', | ||
svg: 'article', | ||
}, | ||
{ | ||
label: 'Book', | ||
svg: 'book', | ||
}, | ||
{ | ||
label: 'Academic Paper', | ||
svg: 'academic-paper', | ||
}, | ||
{ | ||
label: 'Report', | ||
svg: 'report', | ||
}, | ||
{ | ||
label: 'Presentation Slides', | ||
svg: 'presentation', | ||
}, | ||
{ | ||
label: 'Online Training', | ||
svg: 'online-training', | ||
}, | ||
]; | ||
|
||
const resourceCount = 8; | ||
const resourceData = []; | ||
|
||
for ( let i = 0; i < resourceCount; i++ ) { | ||
const thisFormat = formats[i]; | ||
|
||
resourceData.push( { | ||
id: i, | ||
modifier: 'resource', | ||
format: thisFormat.label, | ||
formatIcon: thisFormat.svg, | ||
name: 'Resource', | ||
title: title( faker.lorem.words( faker.random.number( { min: 4, max: 12 } ) ) ), | ||
byline: title( faker.lorem.words( faker.random.number( { min: 2, max: 4 } ) ) ), | ||
locality: faker.address.country(), | ||
topics: [title( faker.company.catchPhraseNoun() ), title( faker.company.catchPhraseNoun() )], | ||
topicCount: faker.random.number( { min: 3, max: 7 } ), | ||
href: 'resource', | ||
standAlone: true, | ||
showRemoveButton: true | ||
} ); | ||
} | ||
|
||
module.exports = { | ||
title: 'Favorites', | ||
status: 'wip', | ||
context: { | ||
bodyClass: 'page page-template-page-favorites', | ||
hasMenu: true, | ||
hasFooter: true, | ||
title: 'Favorites', | ||
cards: resourceData | ||
} | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="page-header"> | ||
<p>{% render '@link--breadcrumb', {label: 'Home', href: '/'}, true %}</p> | ||
<h1>{{ title }}</h1> | ||
</div> | ||
<div class="align-right"> | ||
{% render '@button--destructive-borderless', {label: 'Remove all', icon: 'delete', standAlone: true, className: 'remove-all-favorites'}, true %} | ||
</div> | ||
<div class="resource-list"> | ||
<ul class="cards"> | ||
{% for card in cards %} | ||
{% render '@card--resource', card %} | ||
{% endfor %} | ||
</ul> | ||
</div> |