Static output formatting adjustments (#2566)
This commit is contained in:
parent
06be45d23f
commit
4950250b0d
@ -53,6 +53,7 @@ function Output ({ children, className, help, isError, isHidden, isMonospace, la
|
||||
|
||||
export default React.memo(styled(Output)`
|
||||
pre {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
import { Props as BareProps, RawParam } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { Static } from '@polkadot/react-components';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
@ -19,7 +20,11 @@ interface Props extends BareProps {
|
||||
|
||||
function StaticParam ({ asHex, children, className, defaultValue, label, style }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const value = defaultValue && defaultValue.value && defaultValue.value[asHex ? 'toHex' : 'toString']();
|
||||
const value = defaultValue && defaultValue.value && (
|
||||
asHex
|
||||
? defaultValue.value.toHex()
|
||||
: JSON.stringify(defaultValue.value.toHuman(), null, 2).replace(/"/g, '')
|
||||
);
|
||||
|
||||
return (
|
||||
<Bare
|
||||
@ -29,11 +34,17 @@ function StaticParam ({ asHex, children, className, defaultValue, label, style }
|
||||
<Static
|
||||
className='full'
|
||||
label={label}
|
||||
value={value || t('<empty>')}
|
||||
value={<pre>{value || t('<empty>')}</pre>}
|
||||
/>
|
||||
{children}
|
||||
</Bare>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(StaticParam);
|
||||
export default React.memo(styled(StaticParam)`
|
||||
pre {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
`);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user