diff --git a/packages/component-faraday-ui/src/ShadowedBox.js b/packages/component-faraday-ui/src/ShadowedBox.js index 62de72cb0638cd9e3f95d112c6559ddf6709b792..f2d1afed66cc9c00d1b7412eef4866a89e608d5f 100644 --- a/packages/component-faraday-ui/src/ShadowedBox.js +++ b/packages/component-faraday-ui/src/ShadowedBox.js @@ -1,5 +1,6 @@ import { get } from 'lodash' import { H2 } from '@pubsweet/ui' +import PropTypes from 'prop-types' import styled, { css } from 'styled-components' import { th } from '@pubsweet/ui-toolkit' @@ -9,7 +10,7 @@ const width = props => css` width: calc(${th('gridUnit')} * ${get(props, 'width', 50)}); ` -export default styled.div` +const ShadowedBox = styled.div` background-color: ${th('colorBackgroundHue')}; border-radius: ${th('borderRadius')}; box-shadow: ${th('boxShadow')}; @@ -26,3 +27,15 @@ export default styled.div` text-align: center; } ` +ShadowedBox.propTypes = { + /** Width of shadowed box */ + width: PropTypes.number, + /** Position of shadowed box */ + position: PropTypes.string, +} +ShadowedBox.defaultProps = { + width: 50, + position: 'initial', +} + +export default ShadowedBox diff --git a/packages/component-faraday-ui/src/Tag.js b/packages/component-faraday-ui/src/Tag.js index 3c6997d15e07f9420cfd88520f5c5e69a60de095..a37711bc72e4b111633e26248693206ed87b530e 100644 --- a/packages/component-faraday-ui/src/Tag.js +++ b/packages/component-faraday-ui/src/Tag.js @@ -55,10 +55,10 @@ const Tag = styled.div` ` Tag.propTypes = { - /** if true then object gets properties. */ + /** Old status of the corresponding user. */ oldStatus: PropTypes.bool, - /** if true then object gets properties. */ - status: PropTypes.boo, + /** New status of the corresponding user. */ + status: PropTypes.bool, } Tag.defaultProps = { diff --git a/packages/component-faraday-ui/src/Text.js b/packages/component-faraday-ui/src/Text.js index 06d321cd457795456583e71f4d179e750427f202..aed324d77d53e75ee5bf11623b6c94326e37e271 100644 --- a/packages/component-faraday-ui/src/Text.js +++ b/packages/component-faraday-ui/src/Text.js @@ -100,17 +100,17 @@ const Text = ({ bullet, children, ...rest }) => ) Text.propTypes = { - /** if true then object gets properties. */ + /** Defines what style the secondary text will have. */ secondary: PropTypes.bool, - /** if true then object gets properties. */ + /** Defines what style the error text will have. */ error: PropTypes.bool, - /** if true then object gets properties. */ + /** Defines what style the customId text will have. */ customId: PropTypes.bool, - /** if true then object gets properties. */ + /** Defines what style the labelLine text will have. */ labelLine: PropTypes.bool, - /** if true then object gets properties. */ + /** Defines what style the journal text will have. */ journal: PropTypes.bool, - /** if true thenobject gets properties. */ + /** Defines what style the small text will have. */ small: PropTypes.bool, /** defines how items will be displayed. */ display: PropTypes.string, diff --git a/packages/component-faraday-ui/src/Text.md b/packages/component-faraday-ui/src/Text.md index a99cff36c791742b9c407ace98d9b794b34edf6c..18d57021692c02150f753822defcf8c3083d3f64 100644 --- a/packages/component-faraday-ui/src/Text.md +++ b/packages/component-faraday-ui/src/Text.md @@ -19,12 +19,24 @@ A secondary text. (Body 2) <Text secondary>my boy is amazing</Text> ``` +Error text. + +```js +<Text error>why error?</Text> +``` + A text used for manuscript custom IDs. ```js <Text customId>ID 444222</Text> ``` +A text used for journal. + +```js +<Text journal>text for journal</Text> +``` + A small text. ```js diff --git a/packages/component-faraday-ui/src/Textarea.js b/packages/component-faraday-ui/src/Textarea.js index 8013357da8409d4356a9da67367b7719a41c1d39..91fac36c2976228cb22b6c18c5db3ba91d40b9c5 100644 --- a/packages/component-faraday-ui/src/Textarea.js +++ b/packages/component-faraday-ui/src/Textarea.js @@ -1,4 +1,5 @@ import { get } from 'lodash' +import PropTypes from 'prop-types' import { th } from '@pubsweet/ui-toolkit' import styled, { css } from 'styled-components' @@ -33,6 +34,14 @@ const Textarea = styled.textarea` background-color: ${th('colorBackgroundHue')}; } ` +Textarea.propTypes = { + /** The minimum height that the text box should have */ + minHeight: PropTypes.number, +} + +Textarea.defaultProps = { + minHeight: 10, +} /** @component */ export default Textarea diff --git a/packages/component-manuscript/src/submitRevision/README.md b/packages/component-manuscript/src/submitRevision/README.md index a3b9620b9fd72fcfd5017b5b6cc488b2b31972c1..0ba42dd4bd5aaaf5cb96a90894f54442e4075967 100644 --- a/packages/component-manuscript/src/submitRevision/README.md +++ b/packages/component-manuscript/src/submitRevision/README.md @@ -14,29 +14,68 @@ The `withSubmitRevision` HOC contains the logic for submitting a manuscript vers `submitRevision` namespace contains the following fields: Name|Type|Description ---|---|--- -. initialValues|`{...fragment}`| Object containing the initial state of the fragment -. addFile|`({ file: object, type: string, fragment: object }) => any`|Uploads the file to the server -journal|`???`|??? -. collection|`object`|Object containing the selected collection -. fragment|`object`|Object containing the selected fragment -. canSubmit|`bool`|Value representing if the form doesn't have errors and can be submitted -. addAuthor|`({ author, collectionId: string, fragmentId: string }) => any`|An async call to add an author to the manuscript -changeForm|`function`|Des Cri Pti On! -. deleteFile|`({ fileId: string, type: string }) => any`|Removes the file from the server -. currentUser|`object`|Object containing the currently logged user -onAuthorEdit|`function`|Des Cri Pti On! -. deleteAuthor|`({ authorId, fragmentId, collectionId }) => any`|An async call to remove an existing author from the manuscript -. getSignedUrl|`(id: string) => Promise({signedURL: string})`|An async call that returns the securized S3 file url -hasFormError|`function`|Des Cri Pti On! -formErrors|`function`|Des Cri Pti On! -addResponseFile|`file => any`|Uploads the file and adds it on the form -deleteResponseFile|`file => any`|Deletes the file from the server and removes it from the form +collection|`object`|Object containing the selected collection +fragment|`object`|Object containing the selected fragment +journal|`object`|Deprecated object containing manuscript types +currentUser|`object`|Object containing the currently logged user +initialValues|`{...fragment}`| Object containing the initial state of the fragment isEditingAuthor|`bool`|Value representing if the current user is the editing author -. onChange|`(reduxFormValues, dispatch, { collection, fragment }) => any`|Used to autosave new fragment when fields change -. onSubmit|`(reduxFormValues, dispatch, { history, fragment, collection, showModal, setFetching, canSubmit })`|Handles the submission of a new manuscript version -. validate|`({ editAuthors: , files: array, responseToReviewers: object }) => errors: object`|Checks the form for required fields and returns the errors -. responseFile|`file`|Value containing the revision's file for the reviewer's response +canSubmit|`bool`|Value representing if the form doesn't have errors and can be submitted +hasFormError|`bool`|Value representing if the form has any errors +formErrors|`bool`|Value representing if the form has any errors +responseFile|`file`|Value containing the revision's file for the reviewer's response +addAuthor|`({ author, collectionId: string, fragmentId: string }) => any`|An async call to add an author to the manuscript +deleteAuthor|`({ authorId, fragmentId, collectionId }) => any`|An async call to remove an existing author from the manuscript +onAuthorEdit|`index => authorEditIndex: number`|Chages the form to allow editing of the selected author and returns his index +addFile|`({ file: object, type: string, fragment: object }) => any`|Uploads the file to the server +deleteFile|`({ fileId: string, type: string }) => any`|Removes the file from the server +getSignedUrl|`(id: string) => Promise({signedURL: string})`|An async call that returns the securized S3 file url +addResponseFile|`file => any`|Uploads the file then updates the form +deleteResponseFile|`file => any`|Deletes the file from the server then updates the form +onChange|`(reduxFormValues, dispatch, { collection, fragment }) => any`|Used to autosave new fragment when fields change +validate|`({ editAuthors: , files: array, responseToReviewers: object }) => errors: object`|Checks the form for required fields and returns the errors +onSubmit|`(reduxFormValues, dispatch, { history, fragment, collection, showModal, setFetching, canSubmit })`|Handles the submission of a new manuscript version ```javascript +const ManuscriptLayout = ({submitRevision}) =>( + <SubmitRevision {...submitRevision} /> +) +const SubmitRevision = ({...}) => ( + <Root> + <DetailsAndAuthors + addAuthor={addAuthor} + changeForm={changeForm} + collection={collection} + deleteAuthor={deleteAuthor} + formErrors={formErrors} + fragment={fragment} + isAuthorEdit={isEditingAuthor} + manuscriptTypes={journal.manuscriptTypes} + onAuthorEdit={onAuthorEdit} + /> + + <ManuscriptFiles + changeForm={changeForm} + collection={collection} + deleteFile={deleteFile} + downloadFile={downloadFile} + formErrors={formErrors} + formName="revision" + fragment={fragment} + getSignedUrl={getSignedUrl} + previewFile={previewFile} + token={currentUser.token} + uploadFile={addFile} + /> + + <ResponseToReviewer + file={responseFile} + getSignedUrl={getSignedUrl} + isFetching={isFetching} + onDelete={deleteResponseFile} + onUpload={addResponseFile} + token={currentUser.token} + /> + </Root> ```