DRY in FuncArds render function
parent
a3aa112cc3
commit
c626809e6f
|
@ -29,9 +29,9 @@ export default class FuncArgs extends PureComponent<Props> {
|
||||||
declarationsFromBody,
|
declarationsFromBody,
|
||||||
} = this.props
|
} = this.props
|
||||||
const {name: funcName, id: funcID} = func
|
const {name: funcName, id: funcID} = func
|
||||||
if (funcName === funcNames.JOIN) {
|
|
||||||
return (
|
return (
|
||||||
<div className="func-node--tooltip">
|
<div className="func-node--tooltip">
|
||||||
|
{funcName === funcNames.JOIN ? (
|
||||||
<Join
|
<Join
|
||||||
func={func}
|
func={func}
|
||||||
bodyID={bodyID}
|
bodyID={bodyID}
|
||||||
|
@ -40,22 +40,8 @@ export default class FuncArgs extends PureComponent<Props> {
|
||||||
declarationsFromBody={declarationsFromBody}
|
declarationsFromBody={declarationsFromBody}
|
||||||
onGenerateScript={onGenerateScript}
|
onGenerateScript={onGenerateScript}
|
||||||
/>
|
/>
|
||||||
<div className="func-node--buttons">
|
) : (
|
||||||
<div
|
func.args.map(({key, value, type}) => (
|
||||||
className="btn btn-sm btn-danger func-node--delete"
|
|
||||||
onClick={onDeleteFunc}
|
|
||||||
>
|
|
||||||
Delete
|
|
||||||
</div>
|
|
||||||
{this.build}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div className="func-node--tooltip">
|
|
||||||
{func.args.map(({key, value, type}) => {
|
|
||||||
return (
|
|
||||||
<FuncArg
|
<FuncArg
|
||||||
key={key}
|
key={key}
|
||||||
type={type}
|
type={type}
|
||||||
|
@ -68,8 +54,8 @@ export default class FuncArgs extends PureComponent<Props> {
|
||||||
declarationID={declarationID}
|
declarationID={declarationID}
|
||||||
onGenerateScript={onGenerateScript}
|
onGenerateScript={onGenerateScript}
|
||||||
/>
|
/>
|
||||||
)
|
))
|
||||||
})}
|
)}
|
||||||
<div className="func-node--buttons">
|
<div className="func-node--buttons">
|
||||||
<div
|
<div
|
||||||
className="btn btn-sm btn-danger func-node--delete"
|
className="btn btn-sm btn-danger func-node--delete"
|
||||||
|
|
Loading…
Reference in New Issue