From 87406ee0fdd28e017ceaba561666c1b19f20cd52 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Tue, 23 Jan 2024 23:07:26 -0500 Subject: [PATCH] Render the children. --- src/OrgAst.module.css | 21 ++++++++++++++++++--- src/OrgAst.module.css.d.ts | 1 + src/OrgAst.tsx | 16 +++++++++++----- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/OrgAst.module.css b/src/OrgAst.module.css index 1057acb..5e5d048 100644 --- a/src/OrgAst.module.css +++ b/src/OrgAst.module.css @@ -8,19 +8,34 @@ .OrgAstNode { border: 1px solid #000000; background: #ffffff; - padding: 5px; box-shadow: 3px 3px 4px #000000; > details { - margin-top: 5px; + border: 1px solid #000000; + margin: 5px 5px 5px 2px; > summary { cursor: pointer; - border: 1px solid #000000; padding: 5px 2px; } } + + > details[open] { + > summary { + border-width: 0 0 1px 0; + border-style: dotted; + border-color: #000000; + } + } } .OrgAstNodeType { + font-size: 1.5rem; + font-weight: 700; + background: #6ccff6; + padding: 3px; +} + +.OrgAstChildren { + padding: 5px 5px 5px 20px; } diff --git a/src/OrgAst.module.css.d.ts b/src/OrgAst.module.css.d.ts index 2a0c813..234b36a 100644 --- a/src/OrgAst.module.css.d.ts +++ b/src/OrgAst.module.css.d.ts @@ -1,3 +1,4 @@ export const OrgAst: string; export const OrgAstNode: string; export const OrgAstNodeType: string; +export const OrgAstChildren: string; diff --git a/src/OrgAst.tsx b/src/OrgAst.tsx index ef0d4aa..9d1af03 100644 --- a/src/OrgAst.tsx +++ b/src/OrgAst.tsx @@ -3,7 +3,6 @@ import { parse_org } from "../../organic/target/wasm32-unknown-unknown/js/wasm"; import styles from "./OrgAst.module.css"; const OrgAst = (props: { addHighlight: Function; value: string }) => { - console.log(styles); const ast_tree = parse_org(props.value); console.log(JSON.stringify(ast_tree)); @@ -19,12 +18,10 @@ const OrgAst = (props: { addHighlight: Function; value: string }) => { }; const OrgAstNode = (props: { node: any }) => { - const [isOpen, setIsOpen] = useState(true); - return (
{props.node["ast-node"]}
-
+
Standard Properties
begin
@@ -40,12 +37,21 @@ const OrgAstNode = (props: { node: any }) => {
{Array.isArray(props.node.children) && props.node.children.length > 0 ? ( -
+
Children +
+ +
) : null}
); }; +const OrgAstNodeList = (props: { node_list: any[] }): React.JSX.Element[] => { + return props.node_list.map((node) => { + return ; + }); +}; + export default OrgAst;