mirror of
https://github.com/penpot/penpot.git
synced 2025-06-10 14:01:38 +02:00
🐛 Fix close viewer thumbnail clicking outside
This commit is contained in:
parent
d57d1ef346
commit
04fe8f8960
3 changed files with 36 additions and 19 deletions
|
@ -201,7 +201,7 @@
|
|||
:class (stl/css :go-log-btn)} (tr "labels.log-or-sign")])]))
|
||||
|
||||
(mf/defc header-sitemap
|
||||
[{:keys [project file page frame] :as props}]
|
||||
[{:keys [project file page frame toggle-thumbnails] :as props}]
|
||||
(let [project-name (:name project)
|
||||
file-name (:name file)
|
||||
page-name (:name page)
|
||||
|
@ -209,11 +209,6 @@
|
|||
frame-name (:name frame)
|
||||
show-dropdown? (mf/use-state false)
|
||||
|
||||
toggle-thumbnails
|
||||
(mf/use-fn
|
||||
(fn []
|
||||
(st/emit! dv/toggle-thumbnails-panel)))
|
||||
|
||||
open-dropdown
|
||||
(mf/use-fn
|
||||
(fn []
|
||||
|
@ -254,12 +249,13 @@
|
|||
(when (= page-id id)
|
||||
[:span {:class (stl/css :icon-check)} i/tick])])]]]
|
||||
[:div {:class (stl/css :current-frame)
|
||||
:id "current-frame"
|
||||
:on-click toggle-thumbnails}
|
||||
[:span {:class (stl/css :frame-name)} frame-name]
|
||||
[:span {:class (stl/css :icon)} i/arrow]]]]))
|
||||
|
||||
(mf/defc header
|
||||
[{:keys [project file page frame zoom section permissions index interactions-mode]}]
|
||||
[{:keys [project file page frame zoom section permissions index interactions-mode shown-thumbnails]}]
|
||||
(let [go-to-dashboard
|
||||
(mf/use-fn
|
||||
#(st/emit! (dv/go-to-dashboard)))
|
||||
|
@ -282,13 +278,27 @@
|
|||
(keyword))]
|
||||
(if (or (= section :interactions) (:is-logged permissions))
|
||||
(st/emit! (dv/go-to-section section))
|
||||
(open-login-dialog)))))]
|
||||
(open-login-dialog)))))
|
||||
|
||||
toggle-thumbnails
|
||||
(mf/use-fn
|
||||
(fn []
|
||||
(st/emit! dv/toggle-thumbnails-panel)))
|
||||
|
||||
|
||||
close-thumbnails
|
||||
(mf/use-fn
|
||||
(mf/deps shown-thumbnails)
|
||||
(fn [_]
|
||||
(when shown-thumbnails
|
||||
(st/emit! dv/close-thumbnails-panel))))]
|
||||
|
||||
|
||||
[:header {:class (stl/css-case :viewer-header true
|
||||
:fullscreen (mf/deref fullscreen-ref))}
|
||||
:fullscreen (mf/deref fullscreen-ref))
|
||||
:on-click close-thumbnails}
|
||||
[:div {:class (stl/css :nav-zone)}
|
||||
;; If the user doesn't have permission we disable the link
|
||||
;; If the user doesn't have permission we disable the link
|
||||
[:a {:class (stl/css :home-link)
|
||||
:on-click go-to-dashboard
|
||||
:style {:cursor (when-not (:can-edit permissions) "auto")
|
||||
|
@ -300,6 +310,7 @@
|
|||
:file file
|
||||
:page page
|
||||
:frame frame
|
||||
:toggle-thumbnails toggle-thumbnails
|
||||
:index index}]]
|
||||
|
||||
[:div {:class (stl/css :mode-zone)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue