Skip to content
Snippets Groups Projects
Commit a5cc8949 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

refactor(wizard): merge with alex

parents c5094f06 b6e30db4
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ import { connect } from 'react-redux' ...@@ -4,7 +4,7 @@ import { connect } from 'react-redux'
import { compose, withProps } from 'recompose' import { compose, withProps } from 'recompose'
// import { Icon, Spinner } from '@pubsweet/ui' // import { Icon, Spinner } from '@pubsweet/ui'
import { Icon } from '@pubsweet/ui' import { Icon } from '@pubsweet/ui'
import styled from 'styled-components' import styled, { withTheme } from 'styled-components'
import { getFormValues } from 'redux-form' import { getFormValues } from 'redux-form'
import Spinner from 'pubsweet-components-faraday/src/components/UIComponents/Spinner' import Spinner from 'pubsweet-components-faraday/src/components/UIComponents/Spinner'
...@@ -23,6 +23,7 @@ const Indicator = ({ ...@@ -23,6 +23,7 @@ const Indicator = ({
errorText = 'Changes not saved', errorText = 'Changes not saved',
successText, successText,
autosave: { isFetching, error, lastUpdate }, autosave: { isFetching, error, lastUpdate },
theme,
}) => }) =>
isVisibile ? ( isVisibile ? (
<Root> <Root>
...@@ -46,11 +47,11 @@ const Indicator = ({ ...@@ -46,11 +47,11 @@ const Indicator = ({
error && ( error && (
<AutoSaveContainer> <AutoSaveContainer>
<IconContainer> <IconContainer>
<Icon color="var(--color-danger)" size={16}> <Icon color={theme.colorError} size={16}>
alert-triangle alert-triangle
</Icon> </Icon>
</IconContainer> </IconContainer>
<Info error="var(--color-danger)" title={error}> <Info error={theme.colorError} title={error}>
{errorText} {errorText}
</Info> </Info>
</AutoSaveContainer> </AutoSaveContainer>
...@@ -66,8 +67,10 @@ export default compose( ...@@ -66,8 +67,10 @@ export default compose(
withProps(({ autosave: { isFetching, error, lastUpdate }, form }) => ({ withProps(({ autosave: { isFetching, error, lastUpdate }, form }) => ({
isVisibile: form && Boolean(isFetching || lastUpdate || error), isVisibile: form && Boolean(isFetching || lastUpdate || error),
})), })),
withTheme,
)(Indicator) )(Indicator)
// #region styles
const Root = styled.div` const Root = styled.div`
align-items: center; align-items: center;
display: flex; display: flex;
...@@ -88,3 +91,4 @@ const Info = styled.span` ...@@ -88,3 +91,4 @@ const Info = styled.span`
margin-left: 5px; margin-left: 5px;
color: ${({ error }) => error || ''}; color: ${({ error }) => error || ''};
` `
// #endregion
...@@ -84,28 +84,32 @@ export default ({ ...@@ -84,28 +84,32 @@ export default ({
<AutosaveIndicator /> <AutosaveIndicator />
</Root> </Root>
) )
// #region styles
const Root = styled.div` const Root = styled.div`
align-items: stretch; align-items: stretch;
border: 1px solid var(--color-pending); border: ${({ theme }) => theme.borderDefault};
border-radius: ${({ theme }) => theme.borderRadius};
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
padding: 0 20px;
width: ${({ width }) => width || '800px'}; width: ${({ width }) => width || '800px'};
background-color: ${({ theme }) => theme.colorTextReverse};
` `
const FormContainer = styled.form` const FormContainer = styled.form`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 20px 40px;
` `
const Title = styled.h3` const Title = styled.h5`
align-self: center; align-self: center;
font-size: ${({ theme }) => theme.fontSizeHeading5};
margin-bottom: 10px;
` `
const Subtitle = styled.div` const Subtitle = styled.div`
align-self: center; align-self: center;
margin-bottom: 25px; margin-bottom: 30px;
` `
const ButtonContainer = styled.div` const ButtonContainer = styled.div`
...@@ -113,7 +117,7 @@ const ButtonContainer = styled.div` ...@@ -113,7 +117,7 @@ const ButtonContainer = styled.div`
align-self: center; align-self: center;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
margin: 15px 0; margin: 40px 0 20px;
width: ${({ width }) => width || '400px'}; width: ${({ width }) => width || '400px'};
` `
...@@ -128,3 +132,4 @@ const ModalContainer = styled.div` ...@@ -128,3 +132,4 @@ const ModalContainer = styled.div`
right: 0; right: 0;
top: 0; top: 0;
` `
// #endregion
import React from 'react' import React from 'react'
import styled from 'styled-components'
import uploadFileFn from 'xpub-upload'
import { AbstractEditor, TitleEditor } from 'xpub-edit' import { AbstractEditor, TitleEditor } from 'xpub-edit'
import { Menu, CheckboxGroup, YesOrNo, TextField } from '@pubsweet/ui' import { Menu, CheckboxGroup, YesOrNo, TextField } from '@pubsweet/ui'
import uploadFileFn from 'xpub-upload'
import { required, minChars, minSize } from 'xpub-validators' import { required, minChars, minSize } from 'xpub-validators'
import { AuthorList, Files } from 'pubsweet-components-faraday/src/components' import { AuthorList, Files } from 'pubsweet-components-faraday/src/components'
...@@ -18,22 +19,29 @@ import { ...@@ -18,22 +19,29 @@ import {
const min3Chars = minChars(3) const min3Chars = minChars(3)
const declarationsMinSize = minSize(declarations.options.length) const declarationsMinSize = minSize(declarations.options.length)
// #region styles
const StyledLabel = styled.label`
display: inline-block;
font-weight: bold;
margin-bottom: ${({ margin }) => margin || '5px'};
margin-top: ${({ margin }) => margin || '5px'};
`
const StyledSpacing = styled.div`
width: 100%;
height: 15px;
`
// #endregion
const yesNoWithLabel = ({ label, ...rest }) => ( const yesNoWithLabel = ({ label, ...rest }) => (
<div> <div>
<label style={{ display: 'inline-block', marginBottom: 5, marginTop: 5 }}> <StyledLabel>{label}</StyledLabel>
{label}
</label>
<YesOrNo {...rest} /> <YesOrNo {...rest} />
</div> </div>
) )
const Spacing = () => <div style={{ width: '100%', height: '15px' }} /> const Spacing = () => <StyledSpacing />
const Label = ({ label }) => ( const Label = ({ label }) => <StyledLabel margin="15px">{label}</StyledLabel>
<label
style={{ display: 'inline-block', marginTop: '15px', marginBottom: '5px' }}
>
<b>{label}</b>
</label>
)
const journal = { const journal = {
label: 'Hindawi Faraday', label: 'Hindawi Faraday',
value: 'hindawi-faraday', value: 'hindawi-faraday',
...@@ -69,6 +77,10 @@ export default { ...@@ -69,6 +77,10 @@ export default {
value: journal.value, value: journal.value,
validate: [required], validate: [required],
}, },
{
fieldId: 'spacing-journal',
renderComponent: Spacing,
},
{ {
fieldId: 'label-Issue', fieldId: 'label-Issue',
renderComponent: Label, renderComponent: Label,
...@@ -100,7 +112,7 @@ export default { ...@@ -100,7 +112,7 @@ export default {
label: 'Manuscript & Authors Details', label: 'Manuscript & Authors Details',
title: '3. Manuscript & Authors Details', title: '3. Manuscript & Authors Details',
subtitle: subtitle:
'Please provide the details of all the authors of this manuscript....', 'Please provide the details of all the authors of this manuscript, in the order that they appear on the manuscript. Your details are already pre-filled since, in order tu submit a manuscript you must be one of the authors',
children: [ children: [
{ {
fieldId: 'metadata.title', fieldId: 'metadata.title',
......
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