♻️ Migrate components/code-block to modern component syntax (#9384)

Signed-off-by: tmimmanuel <155203395+tmimmanuel@users.noreply.github.com>
Co-authored-by: tmimmanuel <155203395+tmimmanuel@users.noreply.github.com>
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
tmimmanuel 2026-05-06 13:41:10 -10:00 committed by GitHub
parent eca487afc5
commit f173fafb62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 9 deletions

View File

@ -16,8 +16,7 @@
(def highlight-fn
(delay (modules/load-fn 'app.util.code-highlight/highlight!)))
(mf/defc code-block
{::mf/wrap-props false}
(mf/defc code-block*
[{:keys [code type]}]
(let [block-ref (mf/use-ref)
code (str/trim code)]

View File

@ -17,7 +17,7 @@
[app.main.fonts :as fonts]
[app.main.refs :as refs]
[app.main.store :as st]
[app.main.ui.components.code-block :refer [code-block]]
[app.main.ui.components.code-block :refer [code-block*]]
[app.main.ui.components.copy-button :refer [copy-button*]]
[app.main.ui.components.radio-buttons :refer [radio-button radio-buttons]]
[app.main.ui.hooks.resize :refer [use-resize-hook]]
@ -299,8 +299,8 @@
(when-not collapsed-css?
[:div {:class (stl/css :code-row-display)
:style {:--code-height (dm/str (or style-size 400) "px")}}
[:& code-block {:type style-type
:code style-code}]])
[:> code-block* {:type style-type
:code style-code}]])
[:div {:class (stl/css :resize-area)
:on-pointer-down on-style-pointer-down
@ -340,8 +340,8 @@
(when-not collapsed-markup?
[:div {:class (stl/css :code-row-display)
:style {:--code-height (dm/str (or markup-size 400) "px")}}
[:& code-block {:type markup-type
:code markup-code}]])
[:> code-block* {:type markup-type
:code markup-code}]])
[:div {:class (stl/css :resize-area)
:on-pointer-down on-markup-pointer-down

View File

@ -13,7 +13,7 @@
[app.main.data.modal :as modal]
[app.main.refs :as refs]
[app.main.store :as st]
[app.main.ui.components.code-block :refer [code-block]]
[app.main.ui.components.code-block :refer [code-block*]]
[app.main.ui.ds.buttons.button :refer [button*]]
[app.main.ui.ds.foundations.assets.icon :refer [icon*] :as i]
[app.main.ui.ds.foundations.typography.heading :refer [heading*]]
@ -67,7 +67,7 @@
[:> export-tab* {:is-disabled is-disabled
:on-export on-export}
[:div {:class (stl/css :json-preview)}
[:> code-block {:code tokens-json :type "json"}]]]))
[:> code-block* {:code tokens-json :type "json"}]]]))
(defn download-tokens-zip! [multi-file-entries]
(let [writer (-> (zip/blob-writer {:mtype "application/zip"})