From 1c8f84ab4c129be8bf7417df8df27f4190d7f17c Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 27 Jan 2024 15:27:23 -0500 Subject: [PATCH] Very basic org properties rendering. --- src/OrgAst.tsx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/OrgAst.tsx b/src/OrgAst.tsx index 009215e..4a3e1d0 100644 --- a/src/OrgAst.tsx +++ b/src/OrgAst.tsx @@ -1,5 +1,6 @@ import React, { ReactNode, useState } from "react"; import styles from "./OrgAst.module.css"; +import { Fragment } from 'react'; const OrgAst = (props: { setHighlight: Function; @@ -70,6 +71,18 @@ const OrgAstNode = (props: {
{props.node["standard-properties"]["post-blank"]}
+ {!!Object.keys(props.node.properties).length ? ( + <> +
+ Properties + +
+ + ) : null } {Array.isArray(props.node.children) && props.node.children.length > 0 ? (
Children @@ -115,4 +128,25 @@ const OrgAstNodeList = (props: { }); }; +const OrgPropertiesList = (props: { + selectNode: Function; + parentUniqueId: string; + selectedNode: string; + properties: Object; +}): React.JSX.Element => { + const entries = Object.entries(props.properties).map(([key, value]) => { + return ( + +
{key}
+
{JSON.stringify(value)}
+
+ ); + }); + return ( +
+ {entries} +
+ ); +}; + export default OrgAst;