diff --git a/packages/component-faraday-ui/src/AuthorCard.js b/packages/component-faraday-ui/src/AuthorCard.js index 60d324ef3e1d84e8539fb91b6f7d26f18eee3ef2..1c4307d34948b8bc69ca8af9fe4bc40a2abc92c6 100644 --- a/packages/component-faraday-ui/src/AuthorCard.js +++ b/packages/component-faraday-ui/src/AuthorCard.js @@ -133,7 +133,7 @@ const AuthorEdit = ({ const EnhancedAuthorEdit = compose( reduxForm({ form: 'author-edit', - onSubmit: values => console.log('on surmit -> ', values), + onSubmit: values => {}, }), )(AuthorEdit) diff --git a/packages/component-faraday-ui/src/AuthorTag.js b/packages/component-faraday-ui/src/AuthorTag.js new file mode 100644 index 0000000000000000000000000000000000000000..ab46aabc5e48b8edb830aa54f5c449bce8d71d16 --- /dev/null +++ b/packages/component-faraday-ui/src/AuthorTag.js @@ -0,0 +1,30 @@ +import React from 'react' +import styled from 'styled-components' +import { th } from '@pubsweet/ui-toolkit' + +import Tag from './Tag' +import Text from './Text' + +const AuthorTag = ({ + author: { firstName, lastName, isCorresponding, isSubmitting }, +}) => ( + <Root> + <Text>{`${firstName} ${lastName}`}</Text> + {isSubmitting && <Tag>SA</Tag>} + {isCorresponding && <Tag>CA</Tag>} + </Root> +) + +export default AuthorTag + +// #region styles +const Root = styled.div` + align-items: center; + display: flex; + height: calc(${th('gridUnit')} * 3); + + ${Tag} { + margin-left: calc(${th('gridUnit')} / 2); + } +` +// #endregion diff --git a/packages/component-faraday-ui/src/AuthorTag.md b/packages/component-faraday-ui/src/AuthorTag.md new file mode 100644 index 0000000000000000000000000000000000000000..9e6a5cdaddff1e0541536fe11bf012b94275c5c2 --- /dev/null +++ b/packages/component-faraday-ui/src/AuthorTag.md @@ -0,0 +1,26 @@ +An author tag. + +```js +const authors = [ + { + email: 'john.doe@gmail.com', + firstName: 'John', + lastName: 'Doe', + isSubmitting: true, + }, + { + email: 'michael.felps@gmail.com', + firstName: 'Michael', + lastName: 'Felps', + isSubmitting: true, + isCorresponding: true, + }, + { + email: 'barrack.obama@gmail.com', + firstName: 'Barrack', + lastName: 'Obama', + }, +]; + +<div style={{display: 'flex'}}>{authors.map(a => <AuthorTag key={a.email} author={a} />)}</div> +``` diff --git a/packages/component-faraday-ui/src/AuthorTagList.js b/packages/component-faraday-ui/src/AuthorTagList.js new file mode 100644 index 0000000000000000000000000000000000000000..4c65fb7cfed75039882587db5e3bd37ef8b86e42 --- /dev/null +++ b/packages/component-faraday-ui/src/AuthorTagList.js @@ -0,0 +1,25 @@ +import React from 'react' +import styled from 'styled-components' +import { th } from '@pubsweet/ui-toolkit' + +import AuthorTag from './AuthorTag' + +const AuthorTagList = ({ authors, authorKey = 'email', separator = ',' }) => ( + <Root> + {authors + .map(a => <AuthorTag author={a} key={a[authorKey]} />) + .reduce((prev, curr) => [prev, separator, <span> </span>, curr])} + </Root> +) + +export default AuthorTagList + +// #region styles +const Root = styled.div` + align-items: center; + display: flex; + flex-flow: row wrap; + + font-family: ${th('fontReading')}; +` +// #endregion diff --git a/packages/component-faraday-ui/src/AuthorTagList.md b/packages/component-faraday-ui/src/AuthorTagList.md new file mode 100644 index 0000000000000000000000000000000000000000..cbd7729f47ca072e5b33a732f2bf291d3b392e5b --- /dev/null +++ b/packages/component-faraday-ui/src/AuthorTagList.md @@ -0,0 +1,52 @@ +A list of author tags. Used on manuscript card and details. + +```js +const authors = [ + { + email: 'john.doe@gmail.com', + firstName: 'John', + lastName: 'Doe', + isSubmitting: true, + }, + { + email: 'michael.felps@gmail.com', + firstName: 'Michael', + lastName: 'Felps', + isSubmitting: true, + isCorresponding: true, + }, + { + email: 'barrack.obama@gmail.com', + firstName: 'Barrack', + lastName: 'Obama', + }, +] + +;<AuthorTagList authors={authors} /> +``` + +Use a different separator and key for mapping the authors. + +```js +const authors = [ + { + email: 'john.doe@gmail.com', + firstName: 'John', + lastName: 'Doe', + isSubmitting: true, + }, + { + email: 'michael.felps@gmail.com', + firstName: 'Michael', + lastName: 'Felps', + isSubmitting: true, + isCorresponding: true, + }, + { + email: 'barrack.obama@gmail.com', + firstName: 'Barrack', + lastName: 'Obama', + }, +]; +<AuthorTagList separator="* * *" authors={authors} authorKey="firstName" /> +``` diff --git a/packages/component-faraday-ui/src/IconButton.js b/packages/component-faraday-ui/src/IconButton.js index b426dc6ce44b81f0c46a6b7dc170cc7c3b01d704..03762d2eb389734ca19784da7b1578ce377c43da 100644 --- a/packages/component-faraday-ui/src/IconButton.js +++ b/packages/component-faraday-ui/src/IconButton.js @@ -2,7 +2,6 @@ import React from 'react' import { has, get } from 'lodash' import { Icon } from '@pubsweet/ui' import styled, { css } from 'styled-components' -import { th } from '@pubsweet/ui-toolkit' const positionHelper = css` position: ${props => @@ -20,7 +19,6 @@ const IconButton = styled.div` cursor: pointer; display: flex; justify-content: center; - margin: 0 ${th('gridUnit')}; &:hover { opacity: 0.7; } diff --git a/packages/component-faraday-ui/src/ManuscriptCard.js b/packages/component-faraday-ui/src/ManuscriptCard.js new file mode 100644 index 0000000000000000000000000000000000000000..e1c351f4eb1e0f52038b6c24b6e7f53690f69dd5 --- /dev/null +++ b/packages/component-faraday-ui/src/ManuscriptCard.js @@ -0,0 +1,112 @@ +import React from 'react' +import { H3, H4 } from '@pubsweet/ui' +import styled from 'styled-components' +import { th, darken } from '@pubsweet/ui-toolkit' + +import Tag from './Tag' +import Text from './Text' +import Row from './gridItems/Row' +import IconButton from './IconButton' +import AuthorTagList from './AuthorTagList' + +const ManuscriptCard = ({ + fragment: { authors = [], metadata: { title, journal, type } }, + collection: { visibleStatus = 'Draft', handlingEditor, customId }, +}) => ( + <Root> + <MainContainer> + <Row alignItems="center" justify="space-between"> + <H3>{title}</H3> + <Tag status>{visibleStatus}</Tag> + </Row> + <Row alignItems="center" justify="flex-start"> + <AuthorTagList authors={authors} /> + </Row> + <Row alignItems="center" justify="flex-start"> + <Text customId>{`ID ${customId}`}</Text> + <Text secondary>Submitted on 03.07.2018</Text> + <H4>{type}</H4> + <Text secondary>{journal}</Text> + </Row> + <Row alignItems="center" justify="flex-start"> + <H4>Handling editor</H4> + <Text>{handlingEditor.name}</Text> + <H4>Reviewer Reports</H4> + <Text>0 invited</Text> + </Row> + </MainContainer> + <SideNavigation> + <IconButton icon="chevron-right" iconSize={2} /> + </SideNavigation> + </Root> +) + +export default ManuscriptCard + +// #region styles +const MainContainer = styled.div` + justify-content: flex-start; + display: flex; + flex: 1; + flex-direction: column; + padding: calc(${th('gridUnit')} * 2); + padding-bottom: ${th('gridUnit')}; + + ${Row} { + margin-bottom: ${th('gridUnit')}; + + &:nth-child(3) { + ${Text} { + margin-right: ${th('gridUnit')}; + } + + ${H4} { + margin-right: ${th('gridUnit')}; + } + } + + &:last-child { + ${H4} { + margin-right: ${th('gridUnit')}; + } + + ${Text} { + margin-right: calc(${th('gridUnit')} * 5); + } + } + } +` + +const SideNavigation = styled.div` + align-items: center; + background-color: ${th('colorBackgroundHue')}; + border-top-right-radius: ${th('borderRadius')}; + border-bottom-right-radius: ${th('borderRadius')}; + cursor: pointer; + display: flex; + width: calc(${th('gridUnit')} * 5 / 2); + + &:hover { + background-color: ${darken('colorBackgroundHue', 0.05)}; + } +` + +const Root = styled.div` + border-radius: ${th('borderRadius')}; + box-shadow: ${th('boxShadow')}; + display: flex; + + &:hover { + box-shadow: ${th('dashboardCard.hoverShadow')}; + } + + ${H3} { + margin: 0; + margin-bottom: ${th('gridUnit')}; + } + + ${H4} { + margin: 0; + } +` +// #endregion diff --git a/packages/component-faraday-ui/src/ManuscriptCard.md b/packages/component-faraday-ui/src/ManuscriptCard.md new file mode 100644 index 0000000000000000000000000000000000000000..26c57cd9b4c9adc71b13cade3c6273f92abd02f8 --- /dev/null +++ b/packages/component-faraday-ui/src/ManuscriptCard.md @@ -0,0 +1,110 @@ +A manuscript card. + +```js +const authors = [ + { + email: 'john.doe@gmail.com', + firstName: 'John', + lastName: 'Doe', + isSubmitting: true, + }, + { + email: 'michael.felps@gmail.com', + firstName: 'Michael', + lastName: 'Felps', + isSubmitting: true, + isCorresponding: true, + }, + { + email: 'barrack.obama@gmail.com', + firstName: 'Barrack', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail1.com', + firstName: 'Barrack 1', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail2.com', + firstName: 'Barrack 2', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail3.com', + firstName: 'Barrack 3', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail4.com', + firstName: 'Barrack 4', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail5.com', + firstName: 'Barrack 5', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail6.com', + firstName: 'Barrack 6', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail7.com', + firstName: 'Barrack 7', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail8.com', + firstName: 'Barrack 8', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail9.com', + firstName: 'Barrack 9', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail10.com', + firstName: 'Barrack 10', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail11.com', + firstName: 'Barrack 11', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail12.com', + firstName: 'Barrack 12', + lastName: 'Obama', + }, +]; + +const collection = { + customId: '55113358', + visibleStatus: 'Pending Approval', + handlingEditor: { + id: 'he-1', + name: 'Handlington Ignashevici' + }, +} + +const fragment = { + authors, + created: new Date(), + metadata: { + journal: 'Awesomeness', + title: 'A very ok title with many authors', + type: 'Research article', + }, +}; + + +<ManuscriptCard + collection={collection} + fragment={fragment} + authors={authors} + /> +``` \ No newline at end of file diff --git a/packages/component-faraday-ui/src/Tag.js b/packages/component-faraday-ui/src/Tag.js index 1c2d90d25eb1f3dea182aa0768dc65503be56981..2093a3fc8e2e3c896286db988dcc500474b054c6 100644 --- a/packages/component-faraday-ui/src/Tag.js +++ b/packages/component-faraday-ui/src/Tag.js @@ -3,7 +3,8 @@ import { th } from '@pubsweet/ui-toolkit' // #region styles export default styled.div` - background-color: ${th('tag.backgroundColor')}; + background-color: ${props => + props.status ? th('tag.statusBackgroundColor') : th('tag.backgroundColor')}; border-radius: ${th('borderRadius')}; color: ${th('tag.color')}; font-family: ${th('fontInterface')}; diff --git a/packages/component-faraday-ui/src/Tag.md b/packages/component-faraday-ui/src/Tag.md index 94185b96cc46fbc08b91a5ec24b0ddbd38b2076e..ae4a171c9134ca9d7b0893e4d459022c7c80ca92 100644 --- a/packages/component-faraday-ui/src/Tag.md +++ b/packages/component-faraday-ui/src/Tag.md @@ -9,3 +9,9 @@ An editor in chief. ```js <Tag>EiC</Tag> ``` + +A tag used for a manuscript status. + +```js +<Tag status>Pending Approval</Tag> +``` diff --git a/packages/component-faraday-ui/src/Text.js b/packages/component-faraday-ui/src/Text.js index 313d90e6b78bbc2965fab24132d3c549945049ef..ef6dc62e465b4c1054b1818af368092653eb8265 100644 --- a/packages/component-faraday-ui/src/Text.js +++ b/packages/component-faraday-ui/src/Text.js @@ -1,8 +1,27 @@ +import { has } from 'lodash' import { th } from '@pubsweet/ui-toolkit' import styled, { css } from 'styled-components' +const textHelper = props => { + if (has(props, 'secondary')) { + return css` + color: ${th('colorSecondary')}; + font-family: ${th('fontReading')}; + ` + } + if (has(props, 'customId')) { + return css` + color: ${th('colorPrimary')}; + font-family: ${th('fontInterface')}; + ` + } + return css` + color: ${th('colorText')}; + font-family: ${th('fontReading')}; + ` +} + const fontSize = css` - color: ${props => (props.secondary ? th('colorSecondary') : th('colorText'))}; font-size: ${props => props.small ? th('fontSizeBaseSmall') : th('fontSizeBase')}; line-height: ${props => @@ -10,8 +29,8 @@ const fontSize = css` ` const Text = styled.span` - font-family: ${th('fontReading')}; ${fontSize}; + ${textHelper}; ` export default Text diff --git a/packages/component-faraday-ui/src/Text.md b/packages/component-faraday-ui/src/Text.md index 5290ec35f78e51685c0af0f0b354e5cc9294350e..d309e3b3675069839c361408d7cac655eab47d74 100644 --- a/packages/component-faraday-ui/src/Text.md +++ b/packages/component-faraday-ui/src/Text.md @@ -10,6 +10,12 @@ A secondary text. (Body 2) <Text secondary>my boy is amazing</Text> ``` +A text used for manuscript custom IDs. + +```js +<Text customId>ID 444222</Text> +``` + A small text. ```js diff --git a/packages/hindawi-theme/src/index.js b/packages/hindawi-theme/src/index.js index e61163e1d1d9df0803c248167017e0837e674de5..e3e98ed82bbbb5ec52fc83f5898c24c84bb69da2 100644 --- a/packages/hindawi-theme/src/index.js +++ b/packages/hindawi-theme/src/index.js @@ -85,9 +85,14 @@ const hindawiTheme = { tag: { color: '#ffffff', - backgroundColor: '#586971', fontSize: '12px', fontWeight: 'bold', + backgroundColor: '#586971', + statusBackgroundColor: '#dbafc1', + }, + + dashboardCard: { + hoverShadow: '0 1px 2px 1px #939393', }, /* Text variables */ @@ -128,7 +133,7 @@ const hindawiTheme = { borderStyle: 'solid', /* Shadow (for tooltip) */ - boxShadow: '0 2px 4px 0 rgba(51, 51, 51, 0.3)', + boxShadow: '0 1px 2px 1px #dbdbdb', /* Transition */ transitionDuration: '0.2s', // TODO -- julien: not 0.05s