Skip to content
Snippets Groups Projects
Commit 5eb023ca authored by MB Pro's avatar MB Pro
Browse files

fix(menuCountry): fix border error and initial values

parent accc347d
No related branches found
No related tags found
3 merge requests!222Sprint #26,!217Sprint #26,!216fix(menuCountry): fix border error and initial values
...@@ -6,7 +6,7 @@ import { th } from '@pubsweet/ui-toolkit' ...@@ -6,7 +6,7 @@ import { th } from '@pubsweet/ui-toolkit'
import { required } from 'xpub-validators' import { required } from 'xpub-validators'
import { reduxForm, Field } from 'redux-form' import { reduxForm, Field } from 'redux-form'
import { MenuCountry } from 'pubsweet-component-faraday-ui' import { MenuCountry, ItemOverrideAlert } from 'pubsweet-component-faraday-ui'
import { H3, Spinner, Checkbox, TextField, ValidatedField } from '@pubsweet/ui' import { H3, Spinner, Checkbox, TextField, ValidatedField } from '@pubsweet/ui'
import { import {
compose, compose,
...@@ -187,7 +187,7 @@ const AuthorEdit = ({ ...@@ -187,7 +187,7 @@ const AuthorEdit = ({
validate={[required]} validate={[required]}
/> />
</Item> </Item>
<Item vertical> <ItemOverrideAlert vertical>
<Label required>Country</Label> <Label required>Country</Label>
<ValidatedField <ValidatedField
component={MenuCountry} component={MenuCountry}
...@@ -196,7 +196,7 @@ const AuthorEdit = ({ ...@@ -196,7 +196,7 @@ const AuthorEdit = ({
placeholder="Please select" placeholder="Please select"
validate={[required]} validate={[required]}
/> />
</Item> </ItemOverrideAlert>
</Row> </Row>
</AuthorContainer> </AuthorContainer>
) )
......
import React, { Fragment } from 'react' import React, { Fragment } from 'react'
import styled from 'styled-components' import styled from 'styled-components'
import { th, override } from '@pubsweet/ui-toolkit' import { th, override, validationColor } from '@pubsweet/ui-toolkit'
import { startsWith, toLower, get, head } from 'lodash' import { startsWith, toLower, get, head } from 'lodash'
import { withCountries } from 'pubsweet-component-faraday-ui' import { withCountries } from 'pubsweet-component-faraday-ui'
import { compose, withState, withHandlers, withProps } from 'recompose' import { compose, withState, withHandlers, withProps } from 'recompose'
...@@ -20,6 +20,7 @@ const Menu = ({ ...@@ -20,6 +20,7 @@ const Menu = ({
placeholder, placeholder,
handleSelect, handleSelect,
onTextChange, onTextChange,
validationStatus,
}) => ( }) => (
<Fragment> <Fragment>
{open && <CloseOverlay onClick={toggleMenu} />} {open && <CloseOverlay onClick={toggleMenu} />}
...@@ -29,6 +30,7 @@ const Menu = ({ ...@@ -29,6 +30,7 @@ const Menu = ({
onClick={toggleMenu} onClick={toggleMenu}
onKeyUp={onEnter} onKeyUp={onEnter}
placeholder={placeholder} placeholder={placeholder}
validationStatus={validationStatus}
value={userInput} value={userInput}
/> />
{open && ( {open && (
...@@ -46,7 +48,11 @@ const Menu = ({ ...@@ -46,7 +48,11 @@ const Menu = ({
export default compose( export default compose(
withCountries, withCountries,
withState('userInput', 'updateUserInput', ''), withState(
'userInput',
'updateUserInput',
({ value, countryLabel }) => (value ? countryLabel(value) : ''),
),
withState('open', 'updateOptionsVisibility', false), withState('open', 'updateOptionsVisibility', false),
withHandlers({ withHandlers({
handleSelect: ({ handleSelect: ({
...@@ -93,7 +99,7 @@ export default compose( ...@@ -93,7 +99,7 @@ export default compose(
const Input = styled.input` const Input = styled.input`
width: 100%; width: 100%;
height: calc(${th('gridUnit')} * 4); height: calc(${th('gridUnit')} * 4);
border: ${th('accordion.border')}; border: ${th('borderWidth')} ${th('borderStyle')} ${validationColor};
border-radius: ${th('borderRadius')}; border-radius: ${th('borderRadius')};
padding: 0 ${th('gridUnit')}; padding: 0 ${th('gridUnit')};
font-family: ${th('fontHeading')}; font-family: ${th('fontHeading')};
......
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