ghost-portal/packages/ui-app/src/InputExtrinsic/SelectSection.js
Jaco Greeff b11a6981a2
Optimise components (#39)
* ui-react-app -> ui-app

* CopyButton, Input & Password components

* Convert all to use ui-app/{Input, Label}

* Change to PureComponent where we have onChange listeners

* Cleanup layouts

* Swap dropdown components, remove uselexx constructors

* Allow address/account forget

* Bump

* Searching with headers operational

* flex grow/shrink for icon + account add

* Fix balance & transaction display (account/address management)

* Adjust balance layout

* Equalise padding
2018-05-11 18:08:10 +02:00

44 lines
1.2 KiB
JavaScript

// Copyright 2017-2018 Jaco Greeff
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
// @flow
import type { Extrinsic, ExtrinsicSectionName } from '@polkadot/extrinsics/types';
import type { I18nProps } from '../types';
import React from 'react';
import Dropdown from '../Dropdown';
import translate from '../translate';
import createOptions from './options/section';
type Props = I18nProps & {
defaultValue?: ExtrinsicSectionName,
isError?: boolean,
label?: string,
onChange: (value: ExtrinsicSectionName) => void,
type: 'private' | 'public',
value: Extrinsic
};
function SelectSection ({ className, defaultValue, isError, label = '', onChange, style, t, type, value: { section } }: Props): React$Node {
const options = createOptions(type);
return (
<Dropdown
className={['ui--DropdownLinked-Sections', className].join(' ')}
defaultValue={defaultValue}
isError={isError}
label={label || t('input.extrinsic.section', {
defaultValue: 'from extrinsic section'
})}
onChange={onChange}
options={options}
style={style}
value={section}
/>
);
}
export default translate(SelectSection);