add title to call-result values

This commit is contained in:
fernandomg 2020-06-01 23:36:39 -03:00
parent 1442f33d5a
commit a28c598af1
1 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,7 @@ import { useField } from 'react-final-form'
import TextField from 'src/components/forms/TextField'
import Col from 'src/components/layout/Col'
import Paragraph from 'src/components/layout/Paragraph'
import Row from 'src/components/layout/Row'
const RenderOutputParams = () => {
@ -14,8 +15,14 @@ const RenderOutputParams = () => {
}: any = useField('callResults', { value: true })
const multipleResults = !!method && method.outputs.length > 1
return results
? method.outputs.map(({ name, type }, index) => {
return results ? (
<>
<Row align="left" margin="xs">
<Paragraph color="primary" size="lg" style={{ letterSpacing: '-0.5px' }}>
Call result:
</Paragraph>
</Row>
{method.outputs.map(({ name, type }, index) => {
const placeholder = name ? `${name} (${type})` : type
const key = `methodCallResult-${method.name}_${index}_${type}`
const value = multipleResults ? results[index] : results
@ -33,8 +40,9 @@ const RenderOutputParams = () => {
</Col>
</Row>
)
})
: null
})}
</>
) : null
}
export default RenderOutputParams