Skip to content
Snippets Groups Projects
Commit 66679be2 authored by Anca Ursachi's avatar Anca Ursachi
Browse files

fix(iconButton): Disable icon from password validation.

parent 0d609091
No related branches found
No related tags found
2 merge requests!196S25 - EiC submit revision,!189S25
import React from 'react' import React from 'react'
import { Icon } from '@pubsweet/ui' import { Icon } from '@pubsweet/ui'
import styled from 'styled-components' import styled from 'styled-components'
import { positionHelper, marginHelper, paddingHelper } from './styledHelpers' import { positionHelper, marginHelper, paddingHelper } from './styledHelpers'
const IconButton = styled.div` const IconButton = styled.div`
...@@ -10,7 +9,7 @@ const IconButton = styled.div` ...@@ -10,7 +9,7 @@ const IconButton = styled.div`
display: flex; display: flex;
justify-content: center; justify-content: center;
opacity: ${props => (props.disabled ? 0.7 : 1)}; opacity: ${props => (props.disabled ? 0.7 : 1)};
pointer-events: ${props => (props.unclickable ? 'none' : 'auto')};
&:hover { &:hover {
opacity: 0.7; opacity: 0.7;
} }
...@@ -18,16 +17,23 @@ const IconButton = styled.div` ...@@ -18,16 +17,23 @@ const IconButton = styled.div`
&[disabled] { &[disabled] {
cursor: not-allowed; cursor: not-allowed;
} }
${marginHelper}; ${marginHelper};
${paddingHelper}; ${paddingHelper};
${positionHelper}; ${positionHelper};
` `
export default ({ icon, onClick, iconSize = 3, disabled, ...props }) => ( export default ({
icon,
onClick,
unclickable,
iconSize = 3,
disabled,
...props
}) => (
<IconButton <IconButton
disabled={disabled} disabled={disabled}
onClick={!disabled ? onClick : null} onClick={!disabled ? onClick : null}
unclickable={unclickable}
{...props} {...props}
> >
<Icon size={iconSize} {...props}> <Icon size={iconSize} {...props}>
......
...@@ -52,7 +52,7 @@ const PasswordValidation = ({ ...@@ -52,7 +52,7 @@ const PasswordValidation = ({
</Row> </Row>
<Row alignItems="center" justify="flex-start" mb={-1 / 2}> <Row alignItems="center" justify="flex-start" mb={-1 / 2}>
<IconButton icon="info" iconSize={2} ml={-1 / 2} primary /> <IconButton icon="info" iconSize={2} ml={-1 / 2} primary unclickable />
<RulesTitle>The password must contain: </RulesTitle> <RulesTitle>The password must contain: </RulesTitle>
</Row> </Row>
......
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