ghost-portal/packages/ui-reactive/src/TimePeriod.tsx
Jaco Greeff 653c2a505f
Basic info display for 123-code (#641)
* Add withCalls

* withCalls operational

* Basic header display & cleanups

* Global account selector for app

* Remove errant debug log

* Simple transfer applet working

* Update Upgrade.tsx

* Update InputNumber.tsx

* Update Transfer.tsx

* Move TxButton back to 123code (for the time being)

* Good enough for a v1
2019-01-27 12:50:47 +01:00

38 lines
1.0 KiB
TypeScript

// Copyright 2017-2019 @polkadot/ui-reactive 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 { BareProps, CallProps } from '@polkadot/ui-api/types';
import React from 'react';
import { Moment } from '@polkadot/types';
import { withCall } from '@polkadot/ui-api/index';
import { formatNumber } from '@polkadot/ui-app/util/index';
type Props = BareProps & CallProps & {
children?: React.ReactNode,
label?: string,
timestamp_blockPeriod?: Moment
};
class TimePeriod extends React.PureComponent<Props> {
render () {
const { children, className, label = '', style, timestamp_blockPeriod } = this.props;
return (
<div
className={className}
style={style}
>
{label}{
timestamp_blockPeriod
? `${formatNumber(timestamp_blockPeriod.toNumber() * 2)}s`
: '-'
}{children}
</div>
);
}
}
export default withCall('query.timestamp.blockPeriod')(TimePeriod);