diff --git a/app/components/Tab.js b/app/components/Tab.js index fab0f010..e4e9708f 100644 --- a/app/components/Tab.js +++ b/app/components/Tab.js @@ -10,14 +10,19 @@ const NavItem = styled(NavLink)` text-transform: uppercase; color: ${props => props.theme.slate}; letter-spacing: 0.04em; - margin-right: 20px; + margin-right: 24px; padding-bottom: 8px; + + &:hover { + color: ${props => props.theme.slateDark}; + } `; function Tab(props: *) { const activeStyle = { paddingBottom: '5px', borderBottom: `3px solid ${props.theme.slateLight}`, + color: props.theme.slate, }; return ; diff --git a/app/scenes/Collection.js b/app/scenes/Collection.js index 9c7094e7..526bb43d 100644 --- a/app/scenes/Collection.js +++ b/app/scenes/Collection.js @@ -211,8 +211,34 @@ class CollectionScene extends React.Component { Recently published + + Least recently updated + + + A–Z + + + + + + + { ); } + publishedInCollection(collectionId: string): Document[] { + return filter( + Array.from(this.data.values()), + document => + document.collectionId === collectionId && !!document.publishedAt + ); + } + + leastRecentlyUpdatedInCollection(collectionId: string): Document[] { + return orderBy( + this.publishedInCollection(collectionId), + 'updatedAt', + 'asc' + ); + } + recentlyUpdatedInCollection(collectionId: string): Document[] { return orderBy( - filter( - Array.from(this.data.values()), - document => - document.collectionId === collectionId && !!document.publishedAt - ), + this.publishedInCollection(collectionId), 'updatedAt', 'desc' ); @@ -69,16 +81,16 @@ export default class DocumentsStore extends BaseStore { recentlyPublishedInCollection(collectionId: string): Document[] { return orderBy( - filter( - Array.from(this.data.values()), - document => - document.collectionId === collectionId && !!document.publishedAt - ), + this.publishedInCollection(collectionId), 'publishedAt', 'desc' ); } + alphabeticalInCollection(collectionId: string): Document[] { + return naturalSort(this.publishedInCollection(collectionId), 'title'); + } + @computed get starred(): Document[] { return filter(this.orderedData, d => d.starred); @@ -138,6 +150,26 @@ export default class DocumentsStore extends BaseStore { return data; }; + @action + fetchAlphabetical = async (options: ?PaginationParams): Promise<*> => { + return this.fetchNamedPage('list', { + sort: 'title', + direction: 'ASC', + ...options, + }); + }; + + @action + fetchLeastRecentlyUpdated = async ( + options: ?PaginationParams + ): Promise<*> => { + return this.fetchNamedPage('list', { + sort: 'updatedAt', + direction: 'ASC', + ...options, + }); + }; + @action fetchRecentlyPublished = async (options: ?PaginationParams): Promise<*> => { return this.fetchNamedPage('list', {