From 69312f5133734237edaea6ca29e2de9bf3203050 Mon Sep 17 00:00:00 2001 From: polwex Date: Sun, 15 Jun 2025 01:44:45 +0700 Subject: checkpoint here... --- bs5/universal/native/shared/SidebarNoteContent.re | 69 +++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 bs5/universal/native/shared/SidebarNoteContent.re (limited to 'bs5/universal/native/shared/SidebarNoteContent.re') diff --git a/bs5/universal/native/shared/SidebarNoteContent.re b/bs5/universal/native/shared/SidebarNoteContent.re new file mode 100644 index 0000000..36872dc --- /dev/null +++ b/bs5/universal/native/shared/SidebarNoteContent.re @@ -0,0 +1,69 @@ +[@warning "-26-27-32"]; + +open Melange_json.Primitives; + +module Square = { + [@react.component] + let make = (~isExpanded) => { +
+ {React.string("^")} +
; + }; +}; + +[@react.client.component] +let make = + ( + ~id: int, + ~title: string, + ~children: React.element, + ~expandedChildren: React.element, + ) => { + let router = ClientRouter.useRouter(); + let (isExpanded, setIsExpanded) = RR.useStateValue(false); + let (isPending, startTransition) = React.useTransition(); + + let isActive = + switch (router.location.selectedId) { + | Some(selectedId) => selectedId == id + | None => false + }; + +
+
{ + startTransition(() => { + router.navigate({ + selectedId: Some(id), + isEditing: false, + searchText: router.location.searchText, + }) + }) + }}> + children + {isExpanded ? expandedChildren : React.null} +
+
setIsExpanded(!isExpanded)}> + +
+
; +}; -- cgit v1.2.3