Align time format with balance format (units) (#3426)

* Align time format with balance format (units)

* keys
This commit is contained in:
Jaco Greeff 2020-08-15 21:34:23 +02:00 committed by GitHub
parent b27b8eac34
commit 77eecc03c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
import BN from 'bn.js';
import React from 'react';
import styled from 'styled-components';
import { useBlockTime } from '@polkadot/react-hooks';
interface Props {
@ -22,9 +23,21 @@ function BlockToTime ({ blocks, children, className = '', label }: Props): React
return (
<div className={className}>
{label || ''}{text}{children}
{label || ''}{text.split(' ').map((v, index) => index % 2 === 0
? <span key={index}>{` ${v} `}</span>
: (
<span
className='timeUnits'
key={index}
>{v}</span>
)
)}{children}
</div>
);
}
export default React.memo(BlockToTime);
export default React.memo(styled(BlockToTime)`
span.timeUnits {
font-size: 0.9em;
}
`);