Skip to content
Snippets Groups Projects
Commit b5c5ae40 authored by Sinzeanu Demetriad's avatar Sinzeanu Demetriad
Browse files

docs(faraday-ui):

parents 8222a56a 31cc866c
No related branches found
No related tags found
3 merge requests!222Sprint #26,!217Sprint #26,!191Hin 1116 documentation
Showing
with 108 additions and 63 deletions
...@@ -26,7 +26,7 @@ const AuthorTag = ({ ...@@ -26,7 +26,7 @@ const AuthorTag = ({
AuthorTag.propTypes = { AuthorTag.propTypes = {
/** The author you want to be on the card. */ /** The author you want to be on the card. */
author: PropTypes.shape({ author: PropTypes.shape({
id: PropTypes.string, id: PropTypes.number,
firstName: PropTypes.string, firstName: PropTypes.string,
lastName: PropTypes.string, lastName: PropTypes.string,
isCorresponding: PropTypes.bool, isCorresponding: PropTypes.bool,
...@@ -36,7 +36,14 @@ AuthorTag.propTypes = { ...@@ -36,7 +36,14 @@ AuthorTag.propTypes = {
} }
AuthorTag.defaultProps = { AuthorTag.defaultProps = {
author: undefined, author: {
id: undefined,
firstName: undefined,
lastName: undefined,
isCorresponding: undefined,
isSubmitting: undefined,
affiliationNumber: undefined,
},
} }
export default AuthorTag export default AuthorTag
......
...@@ -114,15 +114,16 @@ export default compose( ...@@ -114,15 +114,16 @@ export default compose(
)(AuthorTagList) )(AuthorTagList)
AuthorTagList.propTypes = { AuthorTagList.propTypes = {
/** What label we want to be seen on the card. */
authorKey: PropTypes.string, authorKey: PropTypes.string,
/** All authors we wanna see. */ /** All authors we want to be seen on the card. */
authors: PropTypes.arrayOf(PropTypes.object), authors: PropTypes.arrayOf(PropTypes.object),
/** What separator to be used. */ /** Separator between authors. */
separator: PropTypes.string, separator: PropTypes.string,
/** Tooltip about author details. */ /** Tooltip about author details. */
withTooltip: PropTypes.bool, withTooltip: PropTypes.bool,
/** Show authors affifiations. */
withAffiliations: PropTypes.bool, withAffiliations: PropTypes.bool,
showAffiliation: PropTypes.bool,
} }
AuthorTagList.defaultProps = { AuthorTagList.defaultProps = {
...@@ -131,7 +132,6 @@ AuthorTagList.defaultProps = { ...@@ -131,7 +132,6 @@ AuthorTagList.defaultProps = {
separator: `, `, separator: `, `,
withTooltip: false, withTooltip: false,
withAffiliations: false, withAffiliations: false,
showAffiliation: false,
} }
// #region styles // #region styles
......
...@@ -107,12 +107,14 @@ Use a different separator and key for mapping the authors. ...@@ -107,12 +107,14 @@ Use a different separator and key for mapping the authors.
```js ```js
const authors = [ const authors = [
{ {
id: 1,
email: 'john.doe@gmail.com', email: 'john.doe@gmail.com',
firstName: 'John', firstName: 'John',
lastName: 'Doe', lastName: 'Doe',
isSubmitting: true, isSubmitting: true,
}, },
{ {
id: 2,
email: 'michael.felps@gmail.com', email: 'michael.felps@gmail.com',
firstName: 'Michael', firstName: 'Michael',
lastName: 'Felps', lastName: 'Felps',
...@@ -120,6 +122,7 @@ const authors = [ ...@@ -120,6 +122,7 @@ const authors = [
isCorresponding: true, isCorresponding: true,
}, },
{ {
id: 3,
email: 'barrack.obama@gmail.com', email: 'barrack.obama@gmail.com',
firstName: 'Barrack', firstName: 'Barrack',
lastName: 'Obama', lastName: 'Obama',
......
...@@ -101,7 +101,7 @@ export default compose( ...@@ -101,7 +101,7 @@ export default compose(
)(AutosaveIndicator) )(AutosaveIndicator)
AutosaveIndicator.propTypes = { AutosaveIndicator.propTypes = {
/** Make appear loader until save. */ /** Saving loader. */
autosave: PropTypes.object, // eslint-disable-line autosave: PropTypes.object, // eslint-disable-line
} }
......
...@@ -33,15 +33,18 @@ const Root = styled.div` ...@@ -33,15 +33,18 @@ const Root = styled.div`
${positionHelper}; ${positionHelper};
` `
IconButton.propTypes = { IconButton.propTypes = {
/** Icon name */ /** What icon to be used. */
icon: PropTypes.string, icon: PropTypes.string,
/** Icon size */ /** Size of the icon. */
iconSize: PropTypes.number, iconSize: PropTypes.number,
/** Callback function fired when the component is clicked. */
onClick: PropTypes.func,
} }
IconButton.defaultProps = { IconButton.defaultProps = {
icon: '', icon: undefined,
iconSize: 3, iconSize: 3,
onClick: undefined,
} }
export default IconButton export default IconButton
...@@ -33,15 +33,21 @@ const InfoTooltip = ({ theme, content }) => ( ...@@ -33,15 +33,21 @@ const InfoTooltip = ({ theme, content }) => (
</ThemeProvider> </ThemeProvider>
) )
IconTooltip.propTypes = { IconTooltip.propTypes = {
/** Icon name */ /** What icon to be used. */
icon: PropTypes.string, icon: PropTypes.string,
/** Icon size */ /** Size of the icon. */
iconSize: PropTypes.number, iconSize: PropTypes.number,
/** What content to be used in tooltip. */
content: PropTypes.func,
/** If true the content can be clicked (can be interacted with). */
interactive: PropTypes.bool,
} }
IconTooltip.defaultProps = { IconTooltip.defaultProps = {
icon: 'help-circle', icon: 'help-circle',
iconSize: 3, iconSize: 3,
content: undefined,
interactive: undefined,
} }
export default withTheme(IconTooltip) export default withTheme(IconTooltip)
...@@ -14,7 +14,7 @@ const Label = ({ children, required, ...rest }) => ( ...@@ -14,7 +14,7 @@ const Label = ({ children, required, ...rest }) => (
) )
Label.propTypes = { Label.propTypes = {
/** Mention if the label is require or not. */ /** If true the label is required. */
required: PropTypes.bool, required: PropTypes.bool,
} }
......
...@@ -4,9 +4,8 @@ import styled from 'styled-components' ...@@ -4,9 +4,8 @@ import styled from 'styled-components'
import { th } from '@pubsweet/ui-toolkit' import { th } from '@pubsweet/ui-toolkit'
import { withJournal } from 'xpub-journal' import { withJournal } from 'xpub-journal'
import { H3, H4, DateParser } from '@pubsweet/ui' import { H3, H4, DateParser } from '@pubsweet/ui'
import { compose, withHandlers, setDisplayName, withProps } from 'recompose'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { compose, withHandlers, setDisplayName, withProps } from 'recompose'
import { import {
Tag, Tag,
Text, Text,
...@@ -19,7 +18,6 @@ import { ...@@ -19,7 +18,6 @@ import {
AuthorTagList, AuthorTagList,
ReviewerBreakdown, ReviewerBreakdown,
} from './' } from './'
import { OpenModal } from './modals' import { OpenModal } from './modals'
const ManuscriptCard = ({ const ManuscriptCard = ({
...@@ -29,7 +27,7 @@ const ManuscriptCard = ({ ...@@ -29,7 +27,7 @@ const ManuscriptCard = ({
onCardClick, onCardClick,
canViewReports, canViewReports,
fragment, fragment,
manuscriptType, manuscriptType = {},
collection: { visibleStatus = 'Draft', handlingEditor, customId, id: collId }, collection: { visibleStatus = 'Draft', handlingEditor, customId, id: collId },
}) => { }) => {
const { const {
...@@ -115,7 +113,6 @@ const ManuscriptCard = ({ ...@@ -115,7 +113,6 @@ const ManuscriptCard = ({
</Root> </Root>
) )
} }
export default compose( export default compose(
withJournal, withJournal,
withHandlers({ withHandlers({
...@@ -137,13 +134,27 @@ export default compose( ...@@ -137,13 +134,27 @@ export default compose(
), ),
setDisplayName('ManuscriptCard'), setDisplayName('ManuscriptCard'),
)(ManuscriptCard) )(ManuscriptCard)
// #region styles
ManuscriptCard.propTypes = { ManuscriptCard.propTypes = {
fragment: PropTypes.object.isRequired, // eslint-disable-line fragment: PropTypes.shape({
collection: PropTypes.object.isRequired, // eslint-disable-line authors: PropTypes.arrayOf(PropTypes.object),
created: PropTypes.number,
submitted: PropTypes.number,
metadata: PropTypes.object,
}), // eslint-disable-line
collection: PropTypes.shape({
customId: PropTypes.string,
visibleStatus: PropTypes.string,
handlingEditor: PropTypes.object,
}), // eslint-disable-line
}
ManuscriptCard.defaultProps = {
fragment: {},
collection: undefined,
} }
// #region styles
const MainContainer = styled.div` const MainContainer = styled.div`
justify-content: flex-start; justify-content: flex-start;
display: flex; display: flex;
...@@ -153,7 +164,6 @@ const MainContainer = styled.div` ...@@ -153,7 +164,6 @@ const MainContainer = styled.div`
padding-bottom: ${th('gridUnit')}; padding-bottom: ${th('gridUnit')};
width: calc(100% - (${th('gridUnit')} * 5 / 2)); width: calc(100% - (${th('gridUnit')} * 5 / 2));
overflow: hidden; overflow: hidden;
${Row} { ${Row} {
[data-tooltipped] { [data-tooltipped] {
overflow: hidden; overflow: hidden;
...@@ -171,7 +181,6 @@ const MainContainer = styled.div` ...@@ -171,7 +181,6 @@ const MainContainer = styled.div`
} }
} }
` `
const SideNavigation = styled.div` const SideNavigation = styled.div`
align-items: center; align-items: center;
background-color: ${th('colorBackgroundHue2') background-color: ${th('colorBackgroundHue2')
...@@ -182,7 +191,6 @@ const SideNavigation = styled.div` ...@@ -182,7 +191,6 @@ const SideNavigation = styled.div`
display: flex; display: flex;
width: calc(${th('gridUnit')} * 5 / 2); width: calc(${th('gridUnit')} * 5 / 2);
` `
const Root = styled.div` const Root = styled.div`
background-color: #fff; background-color: #fff;
border-radius: ${th('borderRadius')}; border-radius: ${th('borderRadius')};
...@@ -191,14 +199,11 @@ const Root = styled.div` ...@@ -191,14 +199,11 @@ const Root = styled.div`
display: flex; display: flex;
margin: calc(${th('gridUnit')} / 4) calc(${th('gridUnit')} / 4) margin: calc(${th('gridUnit')} / 4) calc(${th('gridUnit')} / 4)
${th('gridUnit')} calc(${th('gridUnit')} / 4); ${th('gridUnit')} calc(${th('gridUnit')} / 4);
&:hover { &:hover {
box-shadow: ${th('dashboardCard.hoverShadow')}; box-shadow: ${th('dashboardCard.hoverShadow')};
} }
${H3} { ${H3} {
margin: 0; margin: 0;
margin-bottom: ${th('gridUnit')}; margin-bottom: ${th('gridUnit')};
} }
` `
// #endregion
...@@ -3,12 +3,14 @@ A manuscript card. ...@@ -3,12 +3,14 @@ A manuscript card.
```js ```js
const authors = [ const authors = [
{ {
id:1,
email: 'john.doe@gmail.com', email: 'john.doe@gmail.com',
firstName: 'John', firstName: 'John',
lastName: 'Doe', lastName: 'Doe',
isSubmitting: true, isSubmitting: true,
}, },
{ {
id:2,
email: 'michael.felps@gmail.com', email: 'michael.felps@gmail.com',
firstName: 'Michael', firstName: 'Michael',
lastName: 'Felps', lastName: 'Felps',
...@@ -16,26 +18,31 @@ const authors = [ ...@@ -16,26 +18,31 @@ const authors = [
isCorresponding: true, isCorresponding: true,
}, },
{ {
id:3,
email: 'barrack.obama@gmail.com', email: 'barrack.obama@gmail.com',
firstName: 'Barrack', firstName: 'Barrack',
lastName: 'Obama', lastName: 'Obama',
}, },
{ {
id:5,
email: 'barrack.obama@gmail1.com', email: 'barrack.obama@gmail1.com',
firstName: 'Barrack 1', firstName: 'Barrack 1',
lastName: 'Obama', lastName: 'Obama',
}, },
{ {
id:6,
email: 'barrack.obama@gmail2.com', email: 'barrack.obama@gmail2.com',
firstName: 'Barrack 2', firstName: 'Barrack 2',
lastName: 'Obama', lastName: 'Obama',
}, },
{ {
id:7,
email: 'barrack.obama@gmail3.com', email: 'barrack.obama@gmail3.com',
firstName: 'Barrack 3', firstName: 'Barrack 3',
lastName: 'Obama', lastName: 'Obama',
}, },
{ {
id:8,
email: 'barrack.obama@gmail4.com', email: 'barrack.obama@gmail4.com',
firstName: 'Barrack 4', firstName: 'Barrack 4',
lastName: 'Obama', lastName: 'Obama',
......
...@@ -4,7 +4,7 @@ import styled from 'styled-components' ...@@ -4,7 +4,7 @@ import styled from 'styled-components'
import { th } from '@pubsweet/ui-toolkit' import { th } from '@pubsweet/ui-toolkit'
import { Button, Spinner } from '@pubsweet/ui' import { Button, Spinner } from '@pubsweet/ui'
import { compose, withHandlers, withProps } from 'recompose' import { compose, withHandlers, withProps } from 'recompose'
import PropTypes from 'prop-types'
import { Label, OpenModal, Text, withFetching, ActionLink } from '../' import { Label, OpenModal, Text, withFetching, ActionLink } from '../'
const TableView = ({ const TableView = ({
...@@ -100,6 +100,14 @@ export default compose( ...@@ -100,6 +100,14 @@ export default compose(
}), }),
)(PublonsTable) )(PublonsTable)
TableView.propTypes = {
reviewers: PropTypes.arrayOf(PropTypes.object),
}
TableView.defaultProps = {
reviewers: undefined,
}
// #region styles // #region styles
const Table = styled.table` const Table = styled.table`
border-collapse: collapse; border-collapse: collapse;
......
...@@ -3,37 +3,26 @@ A list of publon reviewers. ...@@ -3,37 +3,26 @@ A list of publon reviewers.
```js ```js
const reviewers = [ const reviewers = [
{ {
id: 0, name: 'Ursachi Anca',
email: 'email1@email.com', email: 'anca@thinslices.com',
publishingName: 'Name1', profileUrl: '',
recentOrganizations: { affiliation: 'ts',
name: 'Org1' reviews: 10,
},
numVerifiedReviews: '100'
}, },
{ {
id: 1, name: 'Josh',
email: 'email2@email.com', email: 'josh@thinslices.com',
publishingName: 'Name2', profileUrl: '',
recentOrganizations: { affiliation: 'ts',
name: 'Org2' reviews: 8,
},
numVerifiedReviews: '200'
}, },
{ ]
id: 2, ;<PublonsTable
email: 'email3@email.com', reviewers={reviewers}
publishingName: 'Name3', onInviteReviwer={(reviewer, modalProps) => {
recentOrganizations: { console.log('the reviewer', reviewer)
name: 'Org3'
},
numVerifiedReviews: '300'
},
];
<PublonsTable reviewers={reviewers} onInviteReviwer={(reviewer, modalProps) => { modalProps.setModalError('avem eroare boss')
console.log('the reviewer', reviewer) }}
/>
modalProps.setModalError('avem eroare boss')
}}/>
``` ```
...@@ -94,20 +94,28 @@ export default withProps(({ report, journal: { recommendations } }) => ({ ...@@ -94,20 +94,28 @@ export default withProps(({ report, journal: { recommendations } }) => ({
}))(ReviewerReport) }))(ReviewerReport)
ReviewerReport.propTypes = { ReviewerReport.propTypes = {
/** It's true when you want to appear the reviewer name */ /** True when you want to show reviewer name. */
showOwner: PropTypes.bool, showOwner: PropTypes.bool,
/** Reviewers reports */ /** Pass object with informations about the report. */
report: PropTypes.shape({ report: PropTypes.shape({
/** Unique id for report. */
id: PropTypes.string, id: PropTypes.string,
/** Unique id for user. */
userId: PropTypes.string, userId: PropTypes.string,
/** Comments by reviewers. */
comments: PropTypes.arrayOf(PropTypes.object), comments: PropTypes.arrayOf(PropTypes.object),
/** When the comment was created. */
createdOn: PropTypes.number, createdOn: PropTypes.number,
/** When the comment was updated. */
updatedOn: PropTypes.number, updatedOn: PropTypes.number,
/** When the comment was submited. */
submittedOn: PropTypes.number, submittedOn: PropTypes.number,
/** The recommendation given by reviewer. */
recommendation: PropTypes.string, recommendation: PropTypes.string,
/** Type of recommendation. */
recommendationType: PropTypes.string, recommendationType: PropTypes.string,
}), }),
/** The reviewers recommendations */ /** Pass object with informations about recommendation. */
journal: PropTypes.shape({ journal: PropTypes.shape({
recommendations: PropTypes.arrayOf(PropTypes.object), recommendations: PropTypes.arrayOf(PropTypes.object),
}), }),
......
...@@ -29,6 +29,7 @@ const report = { ...@@ -29,6 +29,7 @@ const report = {
submittedOn: 1538053600624, submittedOn: 1538053600624,
recommendation: 'publish', recommendation: 'publish',
recommendationType: 'review', recommendationType: 'review',
reviewerIndex: 1
} }
const journal = { const journal = {
......
...@@ -85,20 +85,28 @@ export default compose( ...@@ -85,20 +85,28 @@ export default compose(
)(ReviewerReportAuthor) )(ReviewerReportAuthor)
ReviewerReportAuthor.propTypes = { ReviewerReportAuthor.propTypes = {
/** It's true when you want to appear the reviewer name */ /** True when you want to show reviewer name. */
showOwner: PropTypes.bool, showOwner: PropTypes.bool,
/** Reviewers reports */ /** Pass object with informations about the report. */
report: PropTypes.shape({ report: PropTypes.shape({
/** Unique id for report. */
id: PropTypes.string, id: PropTypes.string,
/** Unique id for user. */
userId: PropTypes.string, userId: PropTypes.string,
/** Comments by reviewers. */
comments: PropTypes.arrayOf(PropTypes.object), comments: PropTypes.arrayOf(PropTypes.object),
/** When the comment was created. */
createdOn: PropTypes.number, createdOn: PropTypes.number,
/** When the comment was updated. */
updatedOn: PropTypes.number, updatedOn: PropTypes.number,
/** When the comment was submited. */
submittedOn: PropTypes.number, submittedOn: PropTypes.number,
/** The recommendation given by reviewer. */
recommendation: PropTypes.string, recommendation: PropTypes.string,
/** Type of recommendation. */
recommendationType: PropTypes.string, recommendationType: PropTypes.string,
}), }),
/** The reviewers recommendations */ /** Pass object with informations about recommendation. */
journal: PropTypes.shape({ journal: PropTypes.shape({
recommendations: PropTypes.arrayOf(PropTypes.object), recommendations: PropTypes.arrayOf(PropTypes.object),
}), }),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment