Skip to content

Commit d2e891a

Browse files
committed
Move code to appropriate namespace
1 parent 8a7d184 commit d2e891a

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/quo2/components/icon.cljs

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
(and (string? color)
1212
(not (string/blank? color)))))
1313

14-
(defn- append-to-keyword
15-
[k & xs]
16-
(keyword (apply str
17-
(subs (str k) 1)
18-
xs)))
19-
2014
(defn memo-icon-fn
2115
([icon-name] (memo-icon-fn icon-name nil))
2216
([icon-name
@@ -25,7 +19,7 @@
2519
:or {accessibility-label :icon}}]
2620
(let [size (or size 20)]
2721
^{:key icon-name}
28-
(if-let [svg-icon (get icons.svg/icons (append-to-keyword icon-name "-" size))]
22+
(if-let [svg-icon (icons.svg/get-icon icon-name size)]
2923
[svg-icon
3024
{:size size
3125
:color (when (valid-color? color) color)

src/quo2/components/icons/svg.cljs

+11-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,15 @@
3434
"M9.15142 9.99998L7.07566 12.0757L7.9242 12.9243L9.99994 10.8485L12.0757 12.9242L12.9242 12.0757L10.8485 9.99998L12.9242 7.92421L12.0757 7.07568L9.99994 9.15145L7.92421 7.07572L7.07568 7.92425L9.15142 9.99998Z"
3535
:fill color-2}]]))
3636

37-
(def icons
37+
(def ^:private icons
3838
{:i/clear-20 clear-20})
39+
40+
(defn- append-to-keyword
41+
[k & xs]
42+
(keyword (apply str
43+
(subs (str k) 1)
44+
xs)))
45+
46+
(defn get-icon
47+
[icon-name size]
48+
(get icons (append-to-keyword icon-name "-" size)))

0 commit comments

Comments
 (0)