diff --git a/packages/components-faraday/src/components/MakeDecision/DecisionForm.js b/packages/components-faraday/src/components/MakeDecision/DecisionForm.js index 3e0d8958388f13599cf12488f898e101b9f6745e..fe8f3f38b9d92fd7d7b43bc282aa31509a469a7c 100644 --- a/packages/components-faraday/src/components/MakeDecision/DecisionForm.js +++ b/packages/components-faraday/src/components/MakeDecision/DecisionForm.js @@ -28,7 +28,6 @@ const { FormContainer, TextAreaField, CustomRadioGroup, - CustomValidatedField, } = FormItems const Form = RootContainer.withComponent(FormContainer) @@ -83,13 +82,11 @@ const DecisionForm = ({ <Row> <RowItem vertical> <Label>Comments for Handling Editor</Label> - <CustomValidatedField> - <ValidatedField - component={TextAreaField} - name="messageToHE" - validate={[required]} - /> - </CustomValidatedField> + <ValidatedField + component={TextAreaField} + name="messageToHE" + validate={[required]} + /> </RowItem> </Row> )} diff --git a/packages/components-faraday/src/components/MakeRecommendation/RecommendWizard.js b/packages/components-faraday/src/components/MakeRecommendation/RecommendWizard.js index 1b06f395f9e2780f5ede69aa8684bc32b81a6732..3ef84572bbad69a7e64ecb89dd16d60586f5f8dc 100644 --- a/packages/components-faraday/src/components/MakeRecommendation/RecommendWizard.js +++ b/packages/components-faraday/src/components/MakeRecommendation/RecommendWizard.js @@ -83,10 +83,13 @@ export default compose( const recommendation = utils.parseRecommendationValues(values) createRecommendation(collectionId, fragmentId, recommendation).then(r => { resetForm('recommendation') - getCollections() showModal({ title: 'Recommendation sent', cancelText: 'OK', + onCancel: () => { + getCollections() + hideModal() + }, }) }) }, diff --git a/packages/components-faraday/src/components/MakeRecommendation/StepTwo.js b/packages/components-faraday/src/components/MakeRecommendation/StepTwo.js index ae48f5f41f0e8bbc2f144392ecc1ea23a3ba29fe..7081d58f04ce2e3aa7ecc3ebce86a92aa99ed396 100644 --- a/packages/components-faraday/src/components/MakeRecommendation/StepTwo.js +++ b/packages/components-faraday/src/components/MakeRecommendation/StepTwo.js @@ -27,7 +27,6 @@ const { RootContainer, FormContainer, CustomRadioGroup, - CustomValidatedField, } = FormItems const Form = RootContainer.withComponent(FormContainer) @@ -53,17 +52,13 @@ const StepTwo = ({ <Row> <RowItem vertical> <Label>Message for Editor in Chief (optional)</Label> - <CustomValidatedField> - <ValidatedField component={TextAreaField} name="message.eic" /> - </CustomValidatedField> + <ValidatedField component={TextAreaField} name="message.eic" /> </RowItem> </Row> <Row> <RowItem vertical> <Label>Message for Author (optional)</Label> - <CustomValidatedField> - <ValidatedField component={TextAreaField} name="message.author" /> - </CustomValidatedField> + <ValidatedField component={TextAreaField} name="message.author" /> </RowItem> </Row> {recommendationError && ( @@ -76,7 +71,7 @@ const StepTwo = ({ </Fragment> ) : ( <Fragment> - <CustomRow> + <Row> <RowItem vertical> <Label>REVISION TYPE</Label> <ValidatedField @@ -93,22 +88,20 @@ const StepTwo = ({ validate={[required]} /> </RowItem> - </CustomRow> - <CustomRow> + </Row> + <Row> <RowItem vertical> <Label> REASON & DETAILS <SubLabel>Required</SubLabel> </Label> - <CustomValidatedField> - <ValidatedField - component={TextAreaField} - name="revision.reason" - validate={[required]} - /> - </CustomValidatedField> + <ValidatedField + component={TextAreaField} + name="revision.reason" + validate={[required]} + /> </RowItem> - </CustomRow> + </Row> {!hasNote ? ( <Row> <RowItem> @@ -118,7 +111,7 @@ const StepTwo = ({ </Row> ) : ( <Fragment> - <CustomRow withMargin> + <Row noMargin> <RowItem flex={2}> <Label> INTERNAL NOTE @@ -131,17 +124,15 @@ const StepTwo = ({ </IconButton> <TextButton>Remove</TextButton> </CustomRowItem> - </CustomRow> - <CustomRow> + </Row> + <Row noMargin> <RowItem> - <CustomValidatedField> - <ValidatedField - component={TextAreaField} - name="revision.internal-note" - /> - </CustomValidatedField> + <ValidatedField + component={TextAreaField} + name="revision.internal-note" + /> </RowItem> - </CustomRow> + </Row> </Fragment> )} </Fragment> @@ -218,11 +209,7 @@ const CustomRowItem = RowItem.extend` justify-content: flex-end; & > div { - flex: 0; + justify-content: flex-end; } ` - -const CustomRow = Row.extend` - margin: ${({ withMargin }) => `${withMargin ? 6 : 0}px 0px`}; -` // #endregion diff --git a/packages/components-faraday/src/components/UIComponents/FormItems.js b/packages/components-faraday/src/components/UIComponents/FormItems.js index 11120c0d061ee3e46d42253eec3d7457caa3c24a..fc91cd92289cd7b3d19f80d62a23c2e621151fe2 100644 --- a/packages/components-faraday/src/components/UIComponents/FormItems.js +++ b/packages/components-faraday/src/components/UIComponents/FormItems.js @@ -50,7 +50,12 @@ export const Row = styled.div` display: flex; flex-direction: row; justify-content: space-evenly; - margin: calc(${th('subGridUnit')} * 2) 0; + margin: ${({ noMargin }) => + noMargin ? 0 : css`calc(${th('subGridUnit')} * 2) 0`}; + + div[role='alert'] { + margin-top: 0; + } ` export const RowItem = styled.div` @@ -58,7 +63,6 @@ export const RowItem = styled.div` flex: ${({ flex }) => flex || 1}; flex-direction: ${({ vertical }) => (vertical ? 'column' : 'row')}; justify-content: ${({ centered }) => (centered ? 'center' : 'initial')}; - margin: ${th('subGridUnit')}; & > div { flex: 1; @@ -120,16 +124,4 @@ export const CustomRadioGroup = styled.div` } ` -export const CustomValidatedField = styled.div` - div { - display: flex; - flex-direction: column; - justify-content: flex-start; - - div:last-child { - margin-top: 0; - } - } -` - export const TextAreaField = input => <Textarea {...input} height={70} />