|
|
@@ -1,10 +1,12 @@
|
|
|
(ns logseq.shui.base.core
|
|
|
(:require [logseq.shui.util :as util]
|
|
|
+ [cljs-bean.core :as bean]
|
|
|
[rum.core :as rum]))
|
|
|
|
|
|
(def button-base (util/lsui-wrap "Button" {:static? false}))
|
|
|
(def link (util/lsui-wrap "Link"))
|
|
|
|
|
|
+;; Note: used for the shui popup trigger
|
|
|
(defn trigger-as
|
|
|
([as & props-or-children]
|
|
|
(let [[props children] [(first props-or-children) (rest props-or-children)]
|
|
|
@@ -19,6 +21,17 @@
|
|
|
children (if (map? props) children (cons props children))]
|
|
|
[as props' children])))
|
|
|
|
|
|
+;; Note: fix the custom trigger content
|
|
|
+;; for the {:as-child true} menu trigger
|
|
|
+(defn trigger-child-wrap
|
|
|
+ [& props-and-children]
|
|
|
+ (let [props (first props-and-children)
|
|
|
+ children (rest props-and-children)
|
|
|
+ children (if (map? props) children (cons props children))
|
|
|
+ children (when (seq children) (daiquiri.interpreter/interpret children))
|
|
|
+ props (if (map? props) props {})]
|
|
|
+ (apply js/React.createElement "div" (bean/->js props) children)))
|
|
|
+
|
|
|
;; Note: don't define component with rum/defc
|
|
|
;; to be compatible for the radix as-child option
|
|
|
(defn button
|