mirror of
https://github.com/penpot/penpot.git
synced 2026-05-07 00:58:48 +00:00
♻️ 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:
parent
eca487afc5
commit
f173fafb62
@ -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)]
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user