Forget confirmation & account name editing (#4)

* Forget confirmation & account name editing

* Update ActionBar padding
This commit is contained in:
Jaco Greeff
2019-05-20 15:56:11 +02:00
committed by GitHub
parent 7f35ea1e8e
commit 93b135d685
14 changed files with 158 additions and 42 deletions
@@ -5,8 +5,6 @@
import React from 'react';
import styled from 'styled-components';
import defaults from './defaults';
type Props = {
children: React.ReactNode;
className?: string;
@@ -21,7 +19,7 @@ function ActionBar ({ children, className }: Props) {
}
export default styled(ActionBar)`
padding: ${defaults.boxPadding};
padding: 0.25rem;
text-align: right;
a {
@@ -14,7 +14,7 @@ type Props = {
children?: React.ReactNode;
className?: string,
isHidden?: boolean,
name?: string | null,
name?: React.ReactNode | null,
theme?: 'polkadot' | 'substrate'
};
+21 -9
View File
@@ -10,32 +10,44 @@ import defaults from './defaults';
type Props = {
className?: string,
defaultValue?: string | null,
isError?: boolean,
isFocussed?: boolean,
isReadOnly?: boolean,
label: string,
label?: string | null,
onBlur?: () => void,
onChange?: (value: string) => void,
type?: 'text' | 'password',
value?: string
};
function Input ({ className, label, isFocussed, isReadOnly, onChange, type = 'text', value }: Props) {
function Input ({ className, defaultValue, label, isFocussed, isReadOnly, onBlur, onChange, type = 'text', value }: Props) {
const _onChange = ({ target: { value } }: React.ChangeEvent<HTMLInputElement>): void => {
onChange && onChange(value.trim());
};
const element = (
<input
autoFocus={isFocussed}
defaultValue={defaultValue || undefined}
readOnly={isReadOnly}
onBlur={onBlur}
onChange={_onChange}
type={type}
value={value}
/>
);
if (!label) {
return <div className={className}>{element}</div>;
}
return (
<Label
className={className}
label={label}
>
<input
autoFocus={isFocussed}
readOnly={isReadOnly}
onChange={_onChange}
type={type}
value={value}
/>
{element}
</Label>
);
}