Skip to content

Commit

Permalink
Drop unused emoji-regex require from navbar (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
zampino authored Jan 3, 2023
1 parent 86a6efb commit 8ed0c35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/nextjournal/clerk/render.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@

(defn toc-items [items]
(reduce
(fn [acc {:as item :keys [content children attrs]}]
(fn [acc {:as item :keys [content children attrs emoji]}]
(if content
(let [title (md.transform/->text item)]
(->> {:title title
:emoji emoji
:path (str "#" (:id attrs))
:items (toc-items children)}
(conj acc)
Expand Down
11 changes: 3 additions & 8 deletions src/nextjournal/clerk/render/navbar.cljs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
(ns nextjournal.clerk.render.navbar
(:require ["emoji-regex" :as emoji-regex]
["framer-motion" :as framer-motion :refer [motion AnimatePresence]]
(:require ["framer-motion" :as framer-motion :refer [motion AnimatePresence]]
[nextjournal.clerk.render.localstorage :as localstorage]
[applied-science.js-interop :as j]
[clojure.string :as str]
[reagent.core :as r]))

(def emoji-re (emoji-regex))

(defn stop-event! [event]
(.preventDefault event)
(.stopPropagation event))
Expand Down Expand Up @@ -74,10 +71,8 @@
(into
[:div]
(map-indexed
(fn [i {:keys [path title expanded? loading? items toc]}]
(let [label (or title (str/capitalize (last (str/split path #"/"))))
emoji (when (zero? (.search label emoji-re))
(first (.match label emoji-re)))]
(fn [i {:keys [emoji path title expanded? loading? items toc]}]
(let [label (or title (str/capitalize (last (str/split path #"/"))))]
[:<>
(if (seq items)
[:div.flex.cursor-pointer
Expand Down

0 comments on commit 8ed0c35

Please sign in to comment.