(rum/defcs sidebar < (rum/local "" ::search)
[rum-state {:keys [nses cljs-started? export-filter rel-path static?]}]
(let [*search (::search rum-state)
search (or export-filter @*search)
search (when (seq search)
(re-pattern search))]
[:div
(when cljs-started?
[:input {:class "search"
:on-change #(->> % .-target .-value (reset! *search))
:placeholder "Search"}])
(into [:div {:class "nses"}
(when (seq export-filter)
[:i "Pages to export:"])]
(keep (fn [{:keys [sym type var-syms]}]
(let [vars (when (and search (empty? export-filter))
(->> var-syms
(filter #(re-find search (str %)))
(mapv (fn [var-sym]
[:div {:class "var"}
[:a {:href (var-sym->url rel-path static? type sym var-sym)}
(str var-sym)]]))))]
(when (or (nil? search)
(re-find search (str sym))
(seq vars))
[:div
(when (= type :cljs)
[:div {:class "tag"} "CLJS"])
[:a {:href (ns-sym->url rel-path static? type sym)}
(str sym)]
(when (seq vars)
(into [:div] vars))])))
nses))]))