diff --git a/packages/component-faraday-ui/src/manuscriptDetails/HandlingEditorAnswer.js b/packages/component-faraday-ui/src/manuscriptDetails/HandlingEditorAnswer.js new file mode 100644 index 0000000000000000000000000000000000000000..15dda7a9f27e32963d615c62684d3506f175a7ba --- /dev/null +++ b/packages/component-faraday-ui/src/manuscriptDetails/HandlingEditorAnswer.js @@ -0,0 +1,83 @@ +import React from 'react' +import { get, has } from 'lodash' +import { reduxForm } from 'redux-form' +import { compose, withProps } from 'recompose' +import { Button, RadioGroup, ValidatedField } from '@pubsweet/ui' + +import { + Row, + Item, + Text, + Label, + Textarea, + OpenModal, + ContextualBox, + RowOverrideAlert, +} from '../' + +const options = [ + { label: 'Accept', value: 'accept' }, + { label: 'Decline', value: 'decline' }, +] + +const HandlingEditorAnswer = ({ + disabled, + handleSubmit, + shouldShowComments, +}) => ( + <ContextualBox label="Respond to Editorial Invitation"> + <RowOverrideAlert justify="flex-start" ml={1} mt={1}> + <Item vertical> + <Label required> + Do you agree to be the handling editor for this manuscript? + </Label> + <ValidatedField + component={input => ( + <RadioGroup inline name="decision" options={options} {...input} /> + )} + name="decision" + /> + </Item> + </RowOverrideAlert> + + {shouldShowComments && ( + <RowOverrideAlert ml={1} mt={2}> + <Item vertical> + <Label> + Decline Reason{' '} + <Text secondary small> + Optional + </Text> + </Label> + <ValidatedField component={Textarea} name="reason" /> + </Item> + </RowOverrideAlert> + )} + + <Row justify="flex-end" mb={1} pr={1}> + <OpenModal + onConfirm={modalProps => handleSubmit()(modalProps)} + title="Are you sure?" + > + {showModal => ( + <Button disabled={disabled} onClick={showModal} primary size="medium"> + RESPOND TO INVITATION + </Button> + )} + </OpenModal> + </Row> + </ContextualBox> +) + +export default compose( + withProps(({ formValues }) => ({ + disabled: !has(formValues, 'decision'), + shouldShowComments: get(formValues, 'decision', 'agree') === 'decline', + })), + reduxForm({ + form: 'he-answer-invitation', + onSubmit: (values, dispatch, { onResponse }) => modalProps => { + onResponse(values, modalProps) + }, + }), +)(HandlingEditorAnswer) diff --git a/packages/component-faraday-ui/src/manuscriptDetails/HandlingEditorAnswer.md b/packages/component-faraday-ui/src/manuscriptDetails/HandlingEditorAnswer.md new file mode 100644 index 0000000000000000000000000000000000000000..444b043f6f286420517e7fac6bf3014a7b94bb75 --- /dev/null +++ b/packages/component-faraday-ui/src/manuscriptDetails/HandlingEditorAnswer.md @@ -0,0 +1,15 @@ +Handling Editor answer invitation. + +```js +const formValues = { + decision: 'decline', +}; + +<HandlingEditorAnswer + formValues={formValues} + onResponse={(values, modalProps) => { + console.log('se da surmit', values, modalProps) + modalProps.setModalError('bine coite') + }} +/> +``` diff --git a/packages/hindawi-theme/src/elements/Radio.js b/packages/hindawi-theme/src/elements/Radio.js index db51c9522f6e9e306ec5bb416043ae43e7cfff4a..124dbf44596a4ac8aa6cd35ea9ba63a2b1f429a2 100644 --- a/packages/hindawi-theme/src/elements/Radio.js +++ b/packages/hindawi-theme/src/elements/Radio.js @@ -27,6 +27,7 @@ export default { `, Label: css` color: ${th('colorText')}; + font-family: ${th('fontWriting')}; margin-right: ${th('gridUnit')}; &::before { diff --git a/packages/hindawi-theme/src/index.js b/packages/hindawi-theme/src/index.js index 10265c377adc7006e7da0b1052d4e4dd4b59b0e7..e60cef34f02251ca643b129a64dfc5643f6012bb 100644 --- a/packages/hindawi-theme/src/index.js +++ b/packages/hindawi-theme/src/index.js @@ -64,7 +64,7 @@ const hindawiTheme = { accordion: { headerBackgroundColor: '#ffffff', - backgroundColor: '#f6f6f6', + backgroundColor: '#ffffff', headerFontSize: '16px', headerFontFamily: "'Myriad Pro'", border: '1px solid #dbdbdb',