From 5528247e85f936f61bae45f64c7d0e50ac198e7a Mon Sep 17 00:00:00 2001 From: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> Date: Mon, 8 Jul 2019 12:01:03 +0200 Subject: [PATCH] Add wrong password indication (#1364) * add wronf password indication * white space * with className * alphabetical order --- packages/ui-signer/src/Modal.tsx | 24 +++++++++++------- packages/ui-signer/src/PasswordCheck.tsx | 32 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 packages/ui-signer/src/PasswordCheck.tsx diff --git a/packages/ui-signer/src/Modal.tsx b/packages/ui-signer/src/Modal.tsx index 246f748a3d..43334e8591 100644 --- a/packages/ui-signer/src/Modal.tsx +++ b/packages/ui-signer/src/Modal.tsx @@ -19,9 +19,10 @@ import keyring from '@polkadot/ui-keyring'; import { assert, isFunction } from '@polkadot/util'; import { format } from '@polkadot/util/logger'; +import PasswordCheck from './PasswordCheck'; import Transaction from './Transaction'; -import Unlock from './Unlock'; import translate from './translate'; +import Unlock from './Unlock'; type BaseProps = BareProps & { queue: Array, @@ -167,14 +168,19 @@ class Signer extends React.PureComponent { } return ( - + <> + + + ); } diff --git a/packages/ui-signer/src/PasswordCheck.tsx b/packages/ui-signer/src/PasswordCheck.tsx new file mode 100644 index 0000000000..07d0c77967 --- /dev/null +++ b/packages/ui-signer/src/PasswordCheck.tsx @@ -0,0 +1,32 @@ +// Copyright 2017-2019 @polkadot/ui-signer authors & contributors +// This software may be modified and distributed under the terms +// of the Apache-2.0 license. See the LICENSE file for details. + +import { I18nProps } from '@polkadot/ui-app/types'; + +import React from 'react'; +import styled from 'styled-components'; +import { withMulti } from '@polkadot/ui-api'; + +import translate from './translate'; + +type Props = I18nProps & { + className?: string, + unlockError?: string | null +}; + +function PasswordCheck (props: Props) { + const { className, unlockError, t } = props; + + return unlockError + ?
{t('wrong password')}
+ : null; +} + +export default withMulti( + styled(PasswordCheck)` + margin-left: 15em; + color: #9f3a38; + `, + translate +);