-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #293 from Benaiah/label-cards-in-editorial-workflow
Add meta info to cards in editorial workflow
- Loading branch information
Showing
9 changed files
with
116 additions
and
13 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
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
25 changes: 25 additions & 0 deletions
25
src/components/UnpublishedListing/UnpublishedListingCardMeta.css
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,25 @@ | ||
@import '../UI/theme.css'; | ||
|
||
.cardMeta { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
|
||
height: 34px; | ||
padding: 0 16px; | ||
margin-bottom: -6px; | ||
|
||
font-size: .75em; | ||
text-transform: uppercase; | ||
|
||
background: var(--backgroundColorShaded); | ||
} | ||
|
||
.meta {} | ||
.label { | ||
padding: 5px 8px 4px 8px; | ||
border-radius: var(--borderRadiusLarge); | ||
|
||
background: var(--backgroundAltColor); | ||
color: var(--defaultColorLight) | ||
} |
17 changes: 17 additions & 0 deletions
17
src/components/UnpublishedListing/UnpublishedListingCardMeta.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,17 @@ | ||
import React, { PropTypes } from 'react'; | ||
import styles from './UnpublishedListingCardMeta.css'; | ||
|
||
const UnpublishedListingCardMeta = ({ meta, label }) => | ||
<div className={styles.cardMeta}> | ||
<span className={styles.meta}>{meta}</span> | ||
{(label && label.length > 0) | ||
? <span className={styles.label}>{label}</span> | ||
: ""} | ||
</div>; | ||
|
||
UnpublishedListingCardMeta.propTypes = { | ||
meta: PropTypes.string.isRequired, | ||
label: PropTypes.string, | ||
}; | ||
|
||
export default UnpublishedListingCardMeta; |
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,3 +1,23 @@ | ||
import { zipObject } from 'lodash'; | ||
|
||
export const filterPromises = (arr, filter) => | ||
Promise.all(arr.map(entry => filter(entry))) | ||
.then(bits => arr.filter(entry => bits.shift())); | ||
|
||
export const resolvePromiseProperties = obj => | ||
(new Promise((resolve, reject) => { | ||
// Get the keys which represent promises | ||
const promiseKeys = Object.keys(obj).filter( | ||
key => obj[key] instanceof Promise); | ||
|
||
const promises = promiseKeys.map(key => obj[key]); | ||
|
||
// Resolve all promises | ||
Promise.all(promises) | ||
.then(resolvedPromises => resolve( | ||
// Return a copy of obj with promises overwritten by their | ||
// resolved values | ||
Object.assign(obj, zipObject(promiseKeys, resolvedPromises)))) | ||
// Pass errors to outer promise chain | ||
.catch(err => reject(err)); | ||
})); |
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