mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 06:58:58 -05:00
Automatically show themes and sets on dev and PR previews
This commit is contained in:
parent
37a3fbcec2
commit
157cc5a994
1 changed files with 15 additions and 1 deletions
|
@ -283,8 +283,22 @@
|
||||||
(when @open?
|
(when @open?
|
||||||
[:& sets-list {:selected-set-id selected-set-id}])]))
|
[:& sets-list {:selected-set-id selected-set-id}])]))
|
||||||
|
|
||||||
|
|
||||||
|
(defn dev-or-preview-url? [url]
|
||||||
|
(let [host (-> url js/URL. .-host)
|
||||||
|
pure-host (first (str/split host #":"))
|
||||||
|
domain (second (str/split pure-host #"\."))]
|
||||||
|
(or (= domain "penpot.tokens.studio")
|
||||||
|
(= pure-host "localhost"))))
|
||||||
|
|
||||||
|
(defn location-url-dev-or-preview-url!? []
|
||||||
|
(dev-or-preview-url? js/window.location.href))
|
||||||
|
|
||||||
(defn temp-use-themes-flag []
|
(defn temp-use-themes-flag []
|
||||||
(let [show? (mf/use-state (get @storage ::show-token-themes-sets? false))]
|
(let [show? (mf/use-state (or
|
||||||
|
(location-url-dev-or-preview-url!?)
|
||||||
|
(get @storage ::show-token-themes-sets?)
|
||||||
|
false))]
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(fn []
|
(fn []
|
||||||
(letfn [(toggle! []
|
(letfn [(toggle! []
|
||||||
|
|
Loading…
Add table
Reference in a new issue