From b0e173057af46606f3f41cc60743129dba2d95a6 Mon Sep 17 00:00:00 2001 From: Kimo Knowles Date: Mon, 8 Jul 2024 20:30:32 +0200 Subject: [PATCH] [tree-select] Add custom parts-table title For https://github.com/day8/rf8.day8.com.au/issues/132 --- src/re_demo/tree_select.cljs | 4 ++-- src/re_demo/utils.cljs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/re_demo/tree_select.cljs b/src/re_demo/tree_select.cljs index da4f3b07..226a62ef 100644 --- a/src/re_demo/tree_select.cljs +++ b/src/re_demo/tree_select.cljs @@ -335,5 +335,5 @@ "includes an anchor label. By default, it lists all the selected choices, except if an entire group is selected, then that group appears in place of its descendants."] [args-table tree-select-dropdown-args-desc]]] [demo]]] - [parts-table "tree-select" tree-select-parts-desc] - [parts-table "tree-select-dropdown" tree-select-dropdown-parts-desc]]]) + [parts-table "tree-select" tree-select-parts-desc :title [:span "Parts: " [:code "[:tree-select]"]]] + [parts-table "tree-select-dropdown" tree-select-dropdown-parts-desc :title [:span "Parts: " [:code "[:tree-select]"]]]]]) diff --git a/src/re_demo/utils.cljs b/src/re_demo/utils.cljs index f009cac5..4e2bf5e2 100644 --- a/src/re_demo/utils.cljs +++ b/src/re_demo/utils.cljs @@ -191,14 +191,14 @@ :child [:span notes]]]]) (defn parts-table - [component-name parts] + [component-name parts & {:keys [title]}] (let [name-of-first-part (str (first (remove nil? (map :name parts)))) code-example-spaces (reduce #(str % " ") "" (range (+ (count name-of-first-part) 13)))] [v-box :src (at) :margin "0px 20px 20px 0px" :children (concat - [[title2 "Parts"] + [[title2 (or title "Parts")] [p "This component is constructed from a hierarchy of HTML elements which we refer to as \"parts\"."] [p "re-com gives each of these parts a unique CSS class, so that you can individually target them. Also, each part is identified by a keyword for use in " [:code ":parts"] " like this:" [:br]]