Skip to content

Commit

Permalink
[cleanup] Use u/part non-reactively
Browse files Browse the repository at this point in the history
  • Loading branch information
kimo-k committed Jan 10, 2025
1 parent 130ecb1 commit c3917ea
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/re_com/box.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
:src (at)
:size gap
:height gap]
[u/part gap]) ;; TODO: required to get around a Chrome bug: https://code.google.com/p/chromium/issues/detail?id=423112. Remove once fixed.
(u/part gap {})) ;; TODO: required to get around a Chrome bug: https://code.google.com/p/chromium/issues/detail?id=423112. Remove once fixed.
children (if gap
(interpose gap-form (filter identity children)) ;; filter is to remove possible nils so we don't add unwanted gaps
children)]
Expand Down
4 changes: 2 additions & 2 deletions src/re_com/datepicker.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
(and today (=date cell-date today) (not disabled?)) (into class ["rc-datepicker-today"])
:else class)
class (conj class "rc-datepicker-date")]
[u/part date-cell {:date cell-date
(u/part date-cell {:date cell-date
:label (cljs-time/day cell-date)
:focus-month focus-month
:selected selected
Expand All @@ -462,7 +462,7 @@
:attr (get-in parts [:date :attr])
:style (get-in parts [:date :style])
:parts parts}
:default table-td]))
:default table-td)))
(range 7))))

(defn- table-tbody
Expand Down
24 changes: 12 additions & 12 deletions src/re_com/dropdown.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -435,21 +435,21 @@
{:src (at)
:children
[(when (and show-backdrop? (not= :out (:transitionable state)))
[u/part backdrop
(themed ::backdrop part-props)
:default re-com.dropdown/backdrop])
(u/part backdrop
(themed ::backdrop part-props)
:default re-com.dropdown/backdrop))
[h-box
(themed ::anchor-wrapper
{:src (at)
:attr {:ref anchor-ref!}
:children [[u/part anchor
(themed ::anchor part-props)
:default re-com.dropdown/anchor]
:children [(u/part anchor
(themed ::anchor part-props)
:default re-com.dropdown/anchor)
[gap :size "1"]
[gap :size "5px"]
[u/part indicator
(themed ::indicator part-props)
:default re-com.dropdown/indicator]]})]
(u/part indicator
(themed ::indicator part-props)
:default re-com.dropdown/indicator)]})]
(when (= :open (:openable state))
[body-wrapper {:anchor-ref anchor-ref
:body-ref body-ref
Expand All @@ -458,9 +458,9 @@
:parts parts
:state state
:theme theme}
[u/part body-header (themed ::body-header part-props)]
[u/part body (themed ::body part-props)]
[u/part body-footer (themed ::body-footer part-props)]])]})])))))))
(u/part body-header (themed ::body-header part-props))
(u/part body (themed ::body part-props))
(u/part body-footer (themed ::body-footer part-props))])]})])))))))

(defn- move-to-new-choice
"In a vector of maps (where each map has an :id), return the id of the choice offset posititions away
Expand Down
38 changes: 19 additions & 19 deletions src/re_com/error_modal.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -135,39 +135,39 @@
[(when header
[:<>
[box/gap :size "19px"]
[u/part header args]])
(u/part header args)])
[:<>
(when action
[u/part heading
(themed ::sub-title-2 {:label action :level :level2}) :default
text/title])
(u/part heading
(themed ::sub-title-2 {:label action :level :level2}) :default
text/title))
(when instructions
[text/p instructions])
(when what-happened
[:<>
[u/part heading
(themed ::sub-title-2 {:label what-happened-title :level :level3}) :default text/title]
[u/part what-happened args]])
(u/part heading
(themed ::sub-title-2 {:label what-happened-title :level :level3}) :default text/title)
(u/part what-happened args)])

(when implications
[:<>
[u/part heading
(themed ::sub-title {:label implications-title :level :level3}) :default text/title]
[u/part implications args :default]])
(u/part heading
(themed ::sub-title {:label implications-title :level :level3}) :default text/title)
(u/part implications args :default)])

(when what-to-do
[:<>
[u/part heading (themed ::sub-title {:label what-to-do-title :level :level3}) :default text/title]
[u/part what-to-do args]])]
(u/part heading (themed ::sub-title {:label what-to-do-title :level :level3}) :default text/title)
(u/part what-to-do args)])]

(when (or details error context)
[:<>
[u/part heading
(themed ::sub-title {:label details-title :level :level4})
:default [:strong {:style {:font-size "12px"}} details-title]]
[u/part details args]
[u/part error (themed ::error args)]
[u/part context (themed ::context args)]])
(u/part heading
(themed ::sub-title {:label details-title :level :level4})
:default [:strong {:style {:font-size "12px"}} details-title])
(u/part details args)
(u/part error (themed ::error args))
(u/part context (themed ::context args))])

(when footer
[u/part footer args])]})]]})]})]))
(u/part footer args))]})]]})]})]))
12 changes: 6 additions & 6 deletions src/re_com/tree_select.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
:children
(into
(vec (repeat level [gap :size "10px"]))
[[u/part choice props :default re-com.tree-select/choice]
[(u/part choice props :default re-com.tree-select/choice)
[gap :size "1"]
(when (and show-only-button? @hover?) [solo-button props])])]))))

Expand Down Expand Up @@ -378,7 +378,7 @@
(get-in parts [:expander :class]))
:child
[u/triangle {:direction (if open? :down :right)}]]
[u/part re-com.tree-select/group-item props :default re-com.tree-select/group-item]
(u/part re-com.tree-select/group-item props :default re-com.tree-select/group-item)
[gap :size "1"]
(when (and show-only-button? @hover?) [solo-button props])])]))))

Expand Down Expand Up @@ -631,7 +631,7 @@
alt-text-fn (or alt-text-fn #(->> % :items (map (or label-fn :label)) (str/join ", ")))
group-label-fn (or group-label-fn (comp name last :group))
field-label-fn (or field-label-fn field-label)
labelable-items (labelable-items @model (deref-or-value choices) {:id-fn id-fn})
labelable-items (labelable-items (deref-or-value model) (deref-or-value choices) {:id-fn id-fn})
anchor-label (field-label-fn {:items (distinct-by-id id-fn labelable-items)
:label-fn label-fn
:group-label-fn group-label-fn})
Expand Down Expand Up @@ -668,15 +668,15 @@
:model (if change-on-blur? internal-model model)})])]
[dd/dropdown
(themed ::dropdown
{:label [u/part label {:model (deref-or-value model)
{:label (u/part label {:model (deref-or-value model)
:state state
:placeholder placeholder
:label-fn label-fn
:group-label-fn group-label-fn
:labelable-items labelable-items
:id-fn id-fn}
:default
anchor-label-part]
:default
anchor-label-part)
:placeholder placeholder
:indicator (fn [props]
[h-box
Expand Down

0 comments on commit c3917ea

Please sign in to comment.