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

docs(component-faraday-ui): completed code review changes

parent e7dd4cf4
No related branches found
No related tags found
3 merge requests!222Sprint #26,!217Sprint #26,!191Hin 1116 documentation
Showing
with 74 additions and 84 deletions
......@@ -9,7 +9,6 @@ import { Item, Row, Text } from 'pubsweet-component-faraday-ui'
const AppBar = ({
fixed,
isSubmit,
logo: Logo,
menu: Menu,
createDraft,
......@@ -29,7 +28,6 @@ const AppBar = ({
<Autosave />
</Item>
{createDraft &&
!isSubmit &&
currentUser.user && (
<Button
data-test-id="new-manuscript"
......@@ -57,17 +55,19 @@ const AppBar = ({
)
AppBar.propTypes = {
/** If true, it will be fixed at the top of the screen. */
fixed: PropTypes.bool,
/** Logo that will be added to the fragment. */
logo: PropTypes.func,
currentUser: PropTypes.shape({
user: PropTypes.object,
isAuthenticated: PropTypes.bool,
}),
/** If false will appear an error message. */
/** If false an error message will appear. */
canCreateDraft: PropTypes.bool,
/** Pass the menu component. */
menu: PropTypes.func,
/** Appear an animation until it's save. */
/** Custom component that will be used as an autosave indicator. */
autosave: PropTypes.func,
}
......
......@@ -62,20 +62,14 @@ AuthorReply.propTypes = {
authorName: PropTypes.string,
/** Date of submitted reply. */
submittedOn: PropTypes.number,
/** Download the file from the server then updates the form. */
onDownload: PropTypes.func,
/** Previews the file from the server then updates the form. */
onPreview: PropTypes.func,
/** Reply File. */
replyFile: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
}
AuthorReply.defaultProps = {
replyContent: undefined,
replyContent: '',
replyFile: {},
authorName: undefined,
submittedOn: undefined,
onDownload: () => {},
onPreview: () => {},
authorName: '',
submittedOn: Date.now(),
}
export default withProps(
......
......@@ -114,7 +114,7 @@ export default compose(
)(AuthorTagList)
AuthorTagList.propTypes = {
/** What label we want to be seen on the card. */
/** The identificator label that will be seen on the card. */
authorKey: PropTypes.string,
/** All authors we want to be seen on the card. */
authors: PropTypes.arrayOf(PropTypes.object),
......
......@@ -101,7 +101,7 @@ export default compose(
)(AutosaveIndicator)
AutosaveIndicator.propTypes = {
/** Saving loader. */
/** Displays the status of the form, in progress, saved or error. */
autosave: PropTypes.object, // eslint-disable-line
}
......
......@@ -74,7 +74,9 @@ ContextualBox.propTypes = {
ContextualBox.defaultProps = {
label: '',
// rightChildren: undefined,
rightChildren: undefined,
expanded: false,
toggle: () => {},
}
// #region styles
......
......@@ -25,11 +25,10 @@ const EditorialReportCard = ({
<Root>
<Row justify="space-between" mb={2}>
<Item vertical>
{editorRole === 'HE' ? (
<Label mb={1 / 2}>Recommendation</Label>
) : (
<Label mb={1 / 2}>Decision</Label>
)}
<Label mb={1 / 2}>
{editorRole === 'HE' ? 'Recommendation' : 'Decision'}
</Label>
)
<Text>{recommendation}</Text>
</Item>
......@@ -113,9 +112,9 @@ export default compose(
)(EditorialReportCard)
EditorialReportCard.propTypes = {
/** Label that will be view by public persons. */
/** Label that will be publicly viewed, for example, a message for the author will be seen by other roles also. */
publicLabel: PropTypes.string,
/** Label that will be view by private persons like Editorial Team. */
/** Label that will only be viewed as private message, for example, by the Editorial Team. */
privateLabel: PropTypes.string,
/** Message by editorial team and other information. */
report: PropTypes.shape({
......@@ -129,7 +128,7 @@ EditorialReportCard.propTypes = {
recommendationType: PropTypes.string,
reviewer: PropTypes.object,
}),
/** What is the decision/recommendation by editorial team. */
/** Object containing the list of recommendations. */
journal: PropTypes.shape({
recommendation: PropTypes.arrayOf(PropTypes.object),
}),
......@@ -138,8 +137,8 @@ EditorialReportCard.propTypes = {
EditorialReportCard.defaultProps = {
publicLabel: '',
privateLabel: '',
report: undefined,
journal: undefined,
report: {},
journal: {},
}
// #region styles
const Root = styled.div`
......
......@@ -113,7 +113,7 @@ const FileSection = ({
FileSection.propTypes = {
/** Files that are uploaded. */
files: PropTypes.arrayOf(PropTypes.object),
/** Error you geton uploading. */
/** Error you get on uploading. */
error: PropTypes.string,
/** Titles of manuscript, cover letter and supplimental files. */
title: PropTypes.string,
......@@ -123,23 +123,23 @@ FileSection.propTypes = {
moveItem: PropTypes.func,
/** Extensions allowed to be uploaded. */
allowedFileExtensions: PropTypes.arrayOf(PropTypes.string),
/** Appears when a file was picked. */
/** Callback function fired when a file is picked. */
onFilePick: PropTypes.func,
/** Appears when a file was previwed. */
/** Callback function fired when preview icon is pressed. */
onPreview: PropTypes.func,
/** Appears when a file was downloaded. */
/** Callback function fired when download icon is pressed. */
onDownload: PropTypes.func,
/** Appears when a file was deleted. */
/** Callback function fired when delete icon is pressed. */
onDelete: PropTypes.func,
}
FileSection.defaultProps = {
files: undefined,
error: undefined,
title: undefined,
listId: undefined,
files: {},
error: '',
title: '',
listId: '',
moveItem: () => {},
allowedFileExtensions: undefined,
allowedFileExtensions: [],
onFilePick: () => {},
onPreview: () => {},
onDownload: () => {},
......
......@@ -40,9 +40,9 @@ IconButton.propTypes = {
}
IconButton.defaultProps = {
icon: undefined,
icon: '',
iconSize: 3,
onClick: undefined,
onClick: () => {},
}
export default IconButton
......@@ -46,8 +46,8 @@ IconTooltip.propTypes = {
IconTooltip.defaultProps = {
icon: 'help-circle',
iconSize: 3,
content: undefined,
interactive: undefined,
content: () => {},
interactive: false,
}
export default withTheme(IconTooltip)
......@@ -104,7 +104,7 @@ InviteReviewers.propTypes = {
}
InviteReviewers.defaultProps = {
onInvite: null,
onInvite: () => {},
}
export default compose(
......
......@@ -152,7 +152,7 @@ ManuscriptCard.propTypes = {
ManuscriptCard.defaultProps = {
fragment: {},
collection: undefined,
collection: {},
}
const MainContainer = styled.div`
......
......@@ -73,7 +73,7 @@ Pagination.propTypes = {
}
Pagination.defaultProps = {
page: 1,
hasMore: undefined,
hasMore: false,
maxItems: 23,
itemsPerPage: 10,
changeItemsPerPage: () => {},
......
......@@ -120,14 +120,14 @@ PasswordValidation.propTypes = {
atLeastOnePunctuation: PropTypes.bool,
}
PasswordValidation.defaultProps = {
formName: undefined,
formLabel: undefined,
formName: '',
formLabel: '',
submitFailed: false,
minLength: undefined,
atLeastOneDigit: undefined,
atLeastOneUppercase: undefined,
atLeastOneLowerrcase: undefined,
atLeastOnePunctuation: undefined,
minLength: false,
atLeastOneDigit: false,
atLeastOneUppercase: false,
atLeastOneLowerrcase: false,
atLeastOnePunctuation: false,
}
export default compose(
......
......@@ -111,15 +111,15 @@ PersonInvitation.propTypes = {
}),
}
PersonInvitation.defaultProps = {
id: undefined,
role: undefined,
type: undefined,
reason: undefined,
userId: undefined,
id: '',
role: '',
type: '',
reason: '',
userId: '',
hasAnswer: false,
invitedOn: undefined,
invitedOn: Date.now(),
isAccepted: false,
respondedOn: undefined,
respondedOn: Date.now(),
person: {},
}
......
......@@ -102,10 +102,13 @@ export default compose(
TableView.propTypes = {
reviewers: PropTypes.arrayOf(PropTypes.object),
/** Sends an invitation to the reviewer. */
onInviteReviewer: PropTypes.func,
}
TableView.defaultProps = {
reviewers: undefined,
reviewers: [],
onInviteReviewer: () => {},
}
// #region styles
......
......@@ -77,7 +77,7 @@ const RadioWithComments = ({
)
RadioWithComments.propTypes = {
/** Defines if a fragment si required or not. */
/** Defines if a fragment is required or not. */
required: PropTypes.bool,
/** Values taken by form. */
formValues: PropTypes.object, //eslint-disable-line
......@@ -95,11 +95,11 @@ RadioWithComments.propTypes = {
RadioWithComments.defaultProps = {
required: false,
formValues: {},
radioFieldName: undefined,
commentsFieldName: undefined,
commentsOn: undefined,
commentsLabel: undefined,
radioLabel: undefined,
radioFieldName: '',
commentsFieldName: '',
commentsOn: '',
commentsLabel: '',
radioLabel: '',
}
export default RadioWithComments
......
......@@ -14,10 +14,11 @@ export default withStateHandlers(
)(RemoteOpener)
RemoteOpener.propTypes = {
/** Expands a message for collapse or expand. */
/** Prop used together with toggle. */
expanded: PropTypes.bool,
/** Method used to toggle a message on click. */
toggle: PropTypes.func,
/** Callback function used to control the state of the component.
* To be used together with the `expanded` prop.
*/ toggle: PropTypes.func,
}
RemoteOpener.defaultProps = {
expanded: false,
......
......@@ -124,7 +124,7 @@ ReviewerReport.propTypes = {
ReviewerReport.defaultProps = {
showOwner: false,
report: undefined,
report: {},
journal: { recommendation: [] },
}
// #region styles
......
......@@ -114,7 +114,7 @@ ReviewerReportAuthor.propTypes = {
ReviewerReportAuthor.defaultProps = {
showOwner: false,
report: undefined,
report: {},
journal: { recommendation: [] },
}
......
......@@ -100,24 +100,18 @@ const Text = ({ bullet, children, ...rest }) =>
)
Text.propTypes = {
/** Defines what style the secondary text will have. */
/** Default color for non-primary actions. */
secondary: PropTypes.bool,
/** Defines what style the error text will have. */
/** Default color for error actions. */
error: PropTypes.bool,
/** Defines what style the customId text will have. */
/** Default style for the customId text. */
customId: PropTypes.bool,
/** Defines what style the labelLine text will have. */
/** Default style for text used as a label Line. */
labelLine: PropTypes.bool,
/** Defines what style the journal text will have. */
/** Default style used for journal text. */
journal: PropTypes.bool,
/** Defines what style the small text will have. */
/** Default style used for small text. */
small: PropTypes.bool,
/** defines how items will be displayed. */
display: PropTypes.string,
/** defines how items will be aligned. */
align: PropTypes.string,
/** defines if there will be a white space. */
whiteSpace: PropTypes.string,
}
Text.defaultProps = {
......@@ -127,9 +121,6 @@ Text.defaultProps = {
labelLine: false,
journal: false,
small: false,
display: 'inline-block',
align: 'start',
whiteSpace: 'initial',
}
export default Text
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