* Allow specifying derivation path on account creation (#57) * Allow specifying derivation path on account creation * Improve linting and formatting * Highlight input field when der-path is invalid * Fix header * Hide advanced options * Add tests * Fix name * Improve styling * Change names * Fix case * Add arrow icon * Add smooth transition * Refactor tests Co-authored-by: Bartłomiej Rutkowski <bar.rutkow@gmail.com> * [CI Skip] 0.22.0-beta.7 skip-checks: true * Import account derivation path (#59) * Import account derivation path * Fix test * fix scroll * Lint fix * add tests to importSeed Co-authored-by: Bartłomiej Rutkowski <bartek@ethworks.io> Co-authored-by: Kamil <kamil@ethworks.io> * [CI Skip] 0.22.0-beta.8 skip-checks: true * Hover and copy button (#58) * copy button and change hover * working on * add Toast * chage address width * Minor fixes * Add cursor: hand * Finish merge Co-authored-by: Kamil <kamil@ethworks.io> Co-authored-by: ivan <ivanruch@gmail.com> * [CI Skip] 0.22.0-beta.9 skip-checks: true * Fix build * [CI Skip] 0.23.0-beta.0 skip-checks: true * [CI Skip] Undo Github Actions version bump * [CI Skip] 0.23.0-beta.5 skip-checks: true * Add derive screen (#60) * Add derivation screen * Remove "///password" from derivation path placeholder * Refactor tests Co-authored-by: Bartłomiej Rutkowski <bar.rutkow@gmail.com> Co-authored-by: Anze1m <bartek@ethworks.io> * Improve account menu; fix linting (#61) * Fix test * Fix account menu * Fix linting * [CI Skip] 0.23.0-beta.6 skip-checks: true * Add proper account decoding (#62) * Add proper account decoding * Improve tests and error handling * Fix linting * Add refactoring * Update packages/extension/src/background/handlers/Extension.ts Co-Authored-By: Ivan Rukhavets <ivanruch@gmail.com> * Fix test * Fix linting * Fix actions * Slight UX improvement * Add big red button * Change red button to orange * Wrap in useCallback * Fix linting * Add proper password checking method * Fix linting Co-authored-by: Ivan Rukhavets <ivanruch@gmail.com> * [CI Skip] 0.23.0-beta.7 skip-checks: true * Apply merge fixes (#65) * Fix linting * CI * [CI Skip] 0.24.0-beta.1 skip-checks: true * CR requests * [CI Skip] 0.24.0-beta.2 skip-checks: true * [CI Skip] 0.24.0-beta.2 skip-checks: true Co-authored-by: Ivan Rukhavets <ivanruch@gmail.com> Co-authored-by: Github Actions <action@github.com> Co-authored-by: Kamil <kamil@ethworks.io>
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
// Copyright 2019-2020 @polkadot/extension-ui 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 React from 'react';
|
|
import styled from 'styled-components';
|
|
|
|
import Label from './Label';
|
|
import { Input } from './TextInputs';
|
|
|
|
interface Props {
|
|
className?: string;
|
|
defaultValue?: string | null;
|
|
isError?: boolean;
|
|
isFocused?: boolean;
|
|
isReadOnly?: boolean;
|
|
label: string;
|
|
onBlur?: () => void;
|
|
onChange?: (value: string) => void;
|
|
type?: 'text' | 'password';
|
|
value?: string;
|
|
placeholder?: string;
|
|
}
|
|
|
|
function InputWithLabel ({ className, defaultValue, label, isError, isFocused, isReadOnly, onBlur, onChange, placeholder, type = 'text', value }: Props): React.ReactElement<Props> {
|
|
const _onChange = ({ target: { value } }: React.ChangeEvent<HTMLInputElement>): void => {
|
|
onChange && onChange(value.trim());
|
|
};
|
|
|
|
return (
|
|
<Label
|
|
className={className}
|
|
label={label}
|
|
>
|
|
<Input
|
|
autoCapitalize='off'
|
|
autoCorrect='off'
|
|
autoFocus={isFocused}
|
|
defaultValue={defaultValue || undefined}
|
|
onBlur={onBlur}
|
|
onChange={_onChange}
|
|
readOnly={isReadOnly}
|
|
spellCheck={false}
|
|
type={type}
|
|
value={value}
|
|
withError={isError}
|
|
placeholder={placeholder}
|
|
/>
|
|
</Label>
|
|
);
|
|
}
|
|
|
|
export default styled(InputWithLabel)`
|
|
margin-bottom: 16px;
|
|
`;
|