File tree Expand file tree Collapse file tree 4 files changed +21
-7
lines changed Expand file tree Collapse file tree 4 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 6262                                          [p " For demonstration purposes, a 'dotted' "   [:code  " :border-style"  ] "  is set."  ]
6363                                          [alert-list
6464                                           :src           (at )
65+                                            :re-com        {:from  [:re-demo/alert-list ]}
6566                                           :alerts        alerts
6667                                           :on-close      #(reset!  alerts (remove-id-item  % @alerts))
6768                                           :max-height    " 300px" 
Original file line number Diff line number Diff line change 22  (:require-macros 
33   [re-com.core         :refer  [at]])
44  (:require 
5+    [re-com :as-alias  rc]
56   [re-com.args :as  args]
67   re-com.alert-box.theme
78   re-com.alert-list.theme
6768          :as    props}]
6869      (or 
6970       (validate-args-macro  alert-box-args-desc props)
70-        (let  [part        (partial  part/part part-structure props)
71+        (let  [part        (partial  part/part part-structure ( part/descend   props  ::rc/alert-box ) )
7172             heading?    (part/get-part  part-structure props ::ab/heading )
7273             body?       (part/get-part  part-structure props ::ab/body )
7374             re-com      {:state  {:alert-type  alert-type
182183   (validate-args-macro  alert-list-args-desc props)
183184   (let  [alerts (deref-or-value  alerts)
184185         theme  (theme/comp  pre-theme theme)
185-          part   (partial  part/part alert-list-part-structure props)
186+          part   (partial  part/part alert-list-part-structure ( part/descend   props  ::rc/alert-list ) )
186187         re-com {:state  {:max-height    max-height
187188                         :padding       padding
188189                         :border-style  border-style
Original file line number Diff line number Diff line change 3333  (tu/class  props " rc-alert-heading"  ))
3434
3535(defmethod  bootstrap  ::ab/heading-wrapper 
36-   [props]
37-   (tu/class  props " rc-alert-h4"  ))
36+   [{{:keys  [from]} :re-com  :as  props}]
37+   (cond->  props
38+     :do  (tu/class  " rc-alert-h4"  )
39+     (and  (contains?  (set  from) :re-com/alert-list )
40+          (contains?  (set  from) :re-demo/alert-list ))
41+     (tu/attr  {:title  (str  " This tooltip only appears on an alert-box " 
42+                           " which descends from an alert-list!"  )})))
3843
3944(defmethod  base  ::ab/body-wrapper 
4045  [props]
Original file line number Diff line number Diff line change 149149
150150(def  hiccup?  vector? )
151151
152+ (defn  descend  [props k]
153+   (update-in  props [:re-com  :from ]
154+              (fnil  conj []) k))
155+ 
152156(defn  part 
153-   ([structure props k opts]
157+   ([structure {{ :keys  [from]}  :re-com   :as   props}  k opts]
154158   (part  (get-part  structure props k)
155-      (assoc  opts :part  k)))
156-   ([part-value {:keys    [impl key theme post-props props]
159+          (cond->  opts
160+            :do   (assoc  :part  k)
161+            from (assoc  :from  from))))
162+   ([part-value {:keys    [impl key theme post-props props from]
157163                part-id :part 
158164                :or      {impl default }}]
159165   (-> 
167173                                 props
168174                                 (cond->  {:part  part-id}
169175                                   :do         (merge  props)
176+                                    from       (assoc-in  [:re-com  :from ] from)
170177                                   theme      (theme  component)
171178                                   part-map   (tu/merge-props  part-map)
172179                                   post-props (tu/merge-props  post-props))]
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments