Skip to content

Commit fed6c75

Browse files
committed
refactor
1 parent 3cd6ecb commit fed6c75

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/renderer/attribute/impl/font_family.cljs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@
1616
"The font-family attribute indicates which font family will be used to render the text,
1717
specified as a prioritized list of font family names and/or generic family names.")
1818

19+
(defn font-item
20+
[font]
21+
[:> Command/CommandItem
22+
{:on-select #(rf/dispatch [::element.events/set-attr :font-family font])}
23+
[:div.flex.justify-between.items-center.w-full.gap-2
24+
[:div font]
25+
[:div.leading-none.text-muted
26+
{:style {:font-family font}}
27+
"AaBbCc 0123"]]])
28+
1929
(defn suggestions-list
2030
[font-list]
2131
[:div.flex.flex-col
@@ -34,13 +44,7 @@
3444
"No local fonts found.")]
3545
(for [font font-list]
3646
^{:key font}
37-
[:> Command/CommandItem
38-
{:on-select #(rf/dispatch [::element.events/set-attr :font-family font])}
39-
[:div.flex.justify-between.items-center.w-full.gap-2
40-
[:div font]
41-
[:div.leading-none.text-muted
42-
{:style {:font-family font}}
43-
"AaBbCc 0123"]]])]]]])
47+
[font-item font])]]]])
4448

4549
(defmethod attribute.hierarchy/form-element [:default :font-family]
4650
[_ k v attrs]

0 commit comments

Comments
 (0)