ghost-portal/packages/ui-params/src/Param/Data.tsx
Jaco Greeff 87351fdd1d
Import session keys for author_rotateKeys (#1484)
* Session keys input

* Impoirt session keys for author_rotateKeys

* Bump API

* Defaults
2019-08-08 16:16:57 +02:00

48 lines
1.2 KiB
TypeScript

// Copyright 2017-2019 @polkadot/ui-app 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 { Props } from '../types';
import React from 'react';
import { Input } from '@polkadot/ui-app';
import Bare from './Bare';
export default class Data extends React.PureComponent<Props> {
public render (): React.ReactNode {
const { className, defaultValue: { value }, isDisabled, isError, label, onEnter, style, withLabel } = this.props;
const defaultValue = value || '';
return (
<Bare
className={className}
style={style}
>
<Input
className='full'
defaultValue={defaultValue}
isDisabled={isDisabled}
isError={isError}
label={label}
onChange={this.onChange}
onEnter={onEnter}
placeholder='Hex data'
type='text'
withLabel={withLabel}
/>
</Bare>
);
}
private onChange = (value: string): void => {
const { onChange } = this.props;
const isValid = value.length !== 0;
onChange && onChange({
isValid,
value
});
}
}