Moving the rendering of property values out to their own component.
There is going to be a bunch of logic associated with it to detect what type the value is, so I am moving it out to its own component.
This commit is contained in:
parent
f435e73ec1
commit
3f0ac05513
@ -147,7 +147,14 @@ const OrgPropertiesList = (props: {
|
|||||||
<Fragment key={key}>
|
<Fragment key={key}>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{key}:</th>
|
<th scope="row">{key}:</th>
|
||||||
<td>{JSON.stringify(value)}</td>
|
<td>
|
||||||
|
<OrgPropertyValue
|
||||||
|
selectNode={props.selectNode}
|
||||||
|
parentUniqueId={props.parentUniqueId}
|
||||||
|
selectedNode={props.selectedNode}
|
||||||
|
value={value}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
@ -159,8 +166,17 @@ const OrgPropertiesList = (props: {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const OrgPropertyValue = (props: {
|
||||||
|
selectNode: Function;
|
||||||
|
parentUniqueId: string;
|
||||||
|
selectedNode: string;
|
||||||
|
value: any;
|
||||||
|
}): React.ReactNode => {
|
||||||
|
return JSON.stringify(props.value);
|
||||||
|
};
|
||||||
|
|
||||||
function is_object(val: any): boolean {
|
function is_object(val: any): boolean {
|
||||||
return (val instanceof Object && !(val instanceof Array));
|
return val instanceof Object && !(val instanceof Array);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default OrgAst;
|
export default OrgAst;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user