diff --git a/packages/component-faraday-ui/src/ActionLink.js b/packages/component-faraday-ui/src/ActionLink.js index 7da088b7f4222acd69206dd116a2e9ae64583ae5..84f827ac4634f5a48d9fe3414033b607198a49eb 100644 --- a/packages/component-faraday-ui/src/ActionLink.js +++ b/packages/component-faraday-ui/src/ActionLink.js @@ -34,6 +34,7 @@ const ActionLink = ({ (iconPosition === 'left' && ( <FontIconButton className={`${fontIcon} fontIconStyle`} + onClick={onClick} paddingBottom={paddingBottom} paddingRight={paddingRight} size={size} @@ -50,6 +51,7 @@ const ActionLink = ({ (iconPosition === 'right' && ( <FontIconButton className={`${fontIcon} fontIconStyle`} + onClick={onClick} paddingBottom={paddingBottom} paddingRight={paddingRight} size={size} @@ -109,12 +111,6 @@ const ExternalLink = styled.a` color: ${th('colorSecondary')}; font-family: ${th('fontReading')}; text-decoration: underline; - - &:hover { - color: ${th('colorSecondary')}; - font-family: ${th('fontReading')}; - text-decoration: underline; - } ` const CustomLink = ExternalLink.withComponent(Link) @@ -122,6 +118,9 @@ const Root = styled.div` align-items: center; justify-content: center; display: ${props => (props.to ? 'inline-flex' : 'flex')}; + &:hover * { + color: ${th('colorSecondary')}; + } ${marginHelper}; ${paddingHelper}; diff --git a/packages/component-faraday-ui/src/ManuscriptCard.js b/packages/component-faraday-ui/src/ManuscriptCard.js index d3d8373014192d140a96096d06e6e7068aa0a9c9..eff1058c131c0ee1621c6af660af0699d5cd3910 100644 --- a/packages/component-faraday-ui/src/ManuscriptCard.js +++ b/packages/component-faraday-ui/src/ManuscriptCard.js @@ -75,7 +75,7 @@ const ManuscriptCard = ({ </Text> )} </Row> - <Row alignItems="center" justify="flex-start"> + <Row alignItems="center" height={5} justify="flex-start"> <H4>Handling editor</H4> <Text ml={1} mr={3} whiteSpace="nowrap"> {get(handlingEditor, 'name', 'Unassigned')} @@ -99,7 +99,7 @@ const ManuscriptCard = ({ <DeleteIcon fontIcon="deleteIcon" onClick={showModal} - paddingBottom={2} + paddingBottom={1} paddingRight={0} size={1.65} > @@ -122,7 +122,7 @@ const ManuscriptCard = ({ </Row> </MainContainer> <SideNavigation> - <IconButton fontIcon="arrowRight" iconSize={2} pl={0.4} /> + <IconButton fontIcon="arrowRight" iconSize={2} pl={0.2} /> </SideNavigation> </Root> ) diff --git a/packages/component-faraday-ui/src/MenuCountry.js b/packages/component-faraday-ui/src/MenuCountry.js index 2093858e10a4bf0d229d29e29d4ef5b3674b3df0..3688d473ea93c54ddcbcfffed247f15feac99f77 100644 --- a/packages/component-faraday-ui/src/MenuCountry.js +++ b/packages/component-faraday-ui/src/MenuCountry.js @@ -1,16 +1,13 @@ import React, { Fragment } from 'react' import styled from 'styled-components' import { th, override, validationColor } from '@pubsweet/ui-toolkit' -import { startsWith, toLower, get, head } from 'lodash' +import { startsWith, toLower, get } from 'lodash' import { withCountries } from 'pubsweet-component-faraday-ui' import { compose, withState, withHandlers, withProps } from 'recompose' const filteredCountries = ({ countries, userInput }) => countries.filter(o => startsWith(toLower(o.label), toLower(userInput))) -const firstFilteredCountry = ({ countries, userInput }) => - head(filteredCountries({ countries, userInput })) - const Menu = ({ open, options, @@ -21,6 +18,8 @@ const Menu = ({ handleSelect, onTextChange, validationStatus, + handleKeyDown, + cursor, }) => ( <Fragment> {open && <CloseOverlay onClick={toggleMenu} />} @@ -28,6 +27,7 @@ const Menu = ({ <Input onChange={onTextChange} onClick={toggleMenu} + onKeyDown={handleKeyDown} onKeyUp={onEnter} placeholder={placeholder} validationStatus={validationStatus} @@ -35,8 +35,12 @@ const Menu = ({ /> {open && ( <Options> - {options.map(option => ( - <Option key={option.value} onClick={handleSelect(option.value)}> + {options.map((option, index) => ( + <Option + active={cursor === index} + key={option.value} + onClick={handleSelect(option.value)} + > {option.label} </Option> ))} @@ -53,7 +57,11 @@ export default compose( 'updateUserInput', ({ value, countryLabel }) => (value ? countryLabel(value) : ''), ), + withState('cursor', 'setCursor', 0), withState('open', 'updateOptionsVisibility', false), + withProps(({ countries, userInput }) => ({ + options: filteredCountries({ countries, userInput }), + })), withHandlers({ handleSelect: ({ onChange, @@ -62,6 +70,7 @@ export default compose( updateOptionsVisibility, }) => value => () => { const country = countryLabel(value) + if (country) { onChange(value) updateUserInput(country) @@ -73,26 +82,37 @@ export default compose( toggleMenu: ({ updateOptionsVisibility, open }) => () => { updateOptionsVisibility(!open) }, - onTextChange: ({ updateUserInput, countryLabel, onChange }) => event => { + onTextChange: ({ + updateUserInput, + countryLabel, + onChange, + setCursor, + }) => event => { const inputValue = get(event, 'target.value', '') const country = countryLabel(inputValue) + setCursor(0) updateUserInput(inputValue) if (!country) { onChange('') } }, - onEnter: ({ handleSelect, userInput, countries }) => event => { + onEnter: ({ handleSelect, options, cursor }) => event => { if (event.which === 13) { - handleSelect( - get(firstFilteredCountry({ countries, userInput }), 'value'), - )() + handleSelect(options[cursor].value)() + } + }, + handleKeyDown: ({ setCursor, options }) => event => { + // arrow up + if (event.which === 38) { + setCursor(c => Math.max(0, c - 1)) + } + // arrow down + if (event.which === 40) { + setCursor(c => Math.min(c + 1, options.length - 1)) } }, }), - withProps(({ countries, userInput }) => ({ - options: filteredCountries({ countries, userInput }), - })), )(Menu) // #region styles diff --git a/packages/component-faraday-ui/src/manuscriptDetails/DeleteManuscriptModal.js b/packages/component-faraday-ui/src/manuscriptDetails/DeleteManuscriptModal.js index 9ee27678af282f846b99978396b7f65d1cddd86e..9160fed058fd58d5b13b6fff203a3a24b9e76096 100644 --- a/packages/component-faraday-ui/src/manuscriptDetails/DeleteManuscriptModal.js +++ b/packages/component-faraday-ui/src/manuscriptDetails/DeleteManuscriptModal.js @@ -75,7 +75,7 @@ const DeleteManuscriptModal = props => ( <DeleteIcon fontIcon="deleteIcon" onClick={showModal} - paddingBottom={2} + paddingBottom={1} paddingRight={0} size={1.65} > @@ -94,7 +94,10 @@ DeleteManuscriptModal.defaultProps = { } // #region styles -const DeleteIcon = styled(ActionLink)`` +const DeleteIcon = styled(ActionLink)` + cursor: default; + color: ${th('colorWarning')}; +` const Root = styled.div` align-items: center; background: ${th('colorBackgroundHue')}; diff --git a/packages/component-user/app/components/OpenUserForm.js b/packages/component-user/app/components/OpenUserForm.js index 985c02360c081f1f71128f3c398baa6d57e473bd..6c82000bad018537147c5ca903bf1e7ae6973d08 100644 --- a/packages/component-user/app/components/OpenUserForm.js +++ b/packages/component-user/app/components/OpenUserForm.js @@ -18,13 +18,7 @@ const OpenUserForm = ({ edit, user, onSubmit, modalKey }) => ( > {showModal => edit ? ( - <IconButton - fontIcon="editIcon" - iconSize={2} - onClick={showModal} - paddingBottom={1.5} - pt={1 / 2} - /> + <IconButton fontIcon="editIcon" iconSize={2} onClick={showModal} /> ) : ( <ActionLink icon="plus" onClick={showModal}> ADD USER diff --git a/packages/component-wizard/src/components/SubmissionWizard.js b/packages/component-wizard/src/components/SubmissionWizard.js index 05541ef452a0167ab5f3d35daa3d4f193dd83462..d4d3d9c353e32e188a4b1ec817e379af60312c4e 100644 --- a/packages/component-wizard/src/components/SubmissionWizard.js +++ b/packages/component-wizard/src/components/SubmissionWizard.js @@ -51,6 +51,7 @@ import { onChange, onSubmit, setInitialValues, validate } from './utils' const Wizard = ({ step, history, + canEdit, journal, prevStep, isEditMode, @@ -58,13 +59,12 @@ const Wizard = ({ isFirstStep, handleSubmit, getButtonText, - isLastFragment, isFilesFetching, isAuthorsFetching, journal: { manuscriptTypes = [] }, ...rest }) => - isLastFragment ? ( + canEdit ? ( <Root className="wizard-root"> <Steps currentStep={step}> {wizardSteps.map(({ stepTitle }) => ( @@ -89,12 +89,7 @@ const Wizard = ({ mr={1} onClick={isFirstStep ? history.goBack : prevStep} > - <IconButton - fontIcon="arrowLeft" - mb={0.1} - paddingBottom={1.2} - paddingRight={0.9} - /> + <IconButton fontIcon="arrowLeft" mb={0.1} pb={0.3} /> Back </Button> <Button @@ -104,11 +99,7 @@ const Wizard = ({ primary > {getButtonText()} - <IconButton - fontIcon="arrowRight" - mb={0.1} - paddingBottom={0.5} - /> + <IconButton fontIcon="arrowRight" mb={0.1} pb={0.1} /> </Button> </Fragment> )} @@ -189,8 +180,13 @@ export default compose( reduxAuthorError, isLastFragment: get(fragment, 'id', '') === last(get(collection, 'fragments', [])), + status: get(collection, 'status', ''), }), ), + withProps(({ status, isLastFragment }) => ({ + canEdit: + isLastFragment && !(status === 'accepted' || status === 'rejected'), + })), withHandlers({ getButtonText: ({ isLastStep, isEditMode }) => () => { if (isEditMode && isLastStep) {