style: fix notification text theme issue & ui details

This commit is contained in:
charlie
2020-12-13 12:43:36 +08:00
parent 6ec72bc4ad
commit 2db70bdfc4
7 changed files with 38 additions and 28 deletions

View File

@@ -3,9 +3,14 @@
(rum/defc container
[{:keys [theme on-click] :as props} child]
(rum/use-effect! #(-> js/document.documentElement
(.setAttribute "data-theme" (if (= theme "white") "light" theme)))
[theme])
rum/use-effect! (let [doc js/document.documentElement
cls (.-classList doc)]
(.setAttribute doc "data-theme" (if (= theme "white") "light" theme))
(if (= theme "dark") ;; for tailwind dark mode
(.add cls "dark")
(.remove cls "dark")))
[theme]
[:div
{:class (str theme "-theme")
:on-click on-click}