mirror of
https://github.com/penpot/penpot.git
synced 2025-06-04 04:51:38 +02:00
✨ Change copy texts and style of library dialogs
This commit is contained in:
parent
3e14393c97
commit
3064000a2c
5 changed files with 48 additions and 32 deletions
|
@ -14,12 +14,20 @@
|
|||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr t]]
|
||||
[app.util.data :refer [classnames]]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc confirm-dialog
|
||||
{::mf/register modal/components
|
||||
::mf/register-as :confirm}
|
||||
[{:keys [message title on-accept on-cancel hint cancel-label accept-label] :as props}]
|
||||
[{:keys [message
|
||||
title
|
||||
on-accept
|
||||
on-cancel
|
||||
hint
|
||||
cancel-label
|
||||
accept-label
|
||||
accept-style] :as props}]
|
||||
(let [locale (mf/deref i18n/locale)
|
||||
|
||||
on-accept (or on-accept identity)
|
||||
|
@ -27,6 +35,7 @@
|
|||
message (or message (t locale "ds.confirm-title"))
|
||||
cancel-label (or cancel-label (tr "ds.confirm-cancel"))
|
||||
accept-label (or accept-label (tr "ds.confirm-ok"))
|
||||
accept-style (or accept-style :danger)
|
||||
title (or title (t locale "ds.confirm-title"))
|
||||
|
||||
accept-fn
|
||||
|
@ -58,13 +67,16 @@
|
|||
|
||||
[:div.modal-footer
|
||||
[:div.action-buttons
|
||||
[:input.cancel-button
|
||||
{:type "button"
|
||||
:value cancel-label
|
||||
:on-click cancel-fn}]
|
||||
(when-not (empty? cancel-label)
|
||||
[:input.cancel-button
|
||||
{:type "button"
|
||||
:value cancel-label
|
||||
:on-click cancel-fn}])
|
||||
|
||||
[:input.accept-button
|
||||
{:type "button"
|
||||
{:class (classnames :danger (= accept-style :danger)
|
||||
:primary (= accept-style :primary))
|
||||
:type "button"
|
||||
:value accept-label
|
||||
:on-click accept-fn}]]]]]))
|
||||
|
||||
|
|
|
@ -109,10 +109,12 @@
|
|||
(dom/stop-propagation event)
|
||||
(st/emit! (modal/show
|
||||
{:type :confirm
|
||||
:message (t locale "modals.add-shared-confirm.message" (:name file))
|
||||
:title (t locale "modals.add-shared-confirm.title")
|
||||
:message ""
|
||||
:title (t locale "modals.add-shared-confirm.message" (:name file))
|
||||
:hint (t locale "modals.add-shared-confirm.hint")
|
||||
:cancel-label ""
|
||||
:accept-label (t locale "modals.add-shared-confirm.accept")
|
||||
:accept-style :primary
|
||||
:on-accept add-shared}))))
|
||||
|
||||
on-del-shared
|
||||
|
@ -123,9 +125,10 @@
|
|||
(dom/stop-propagation event)
|
||||
(st/emit! (modal/show
|
||||
{:type :confirm
|
||||
:title (t locale "modals.remove-shared-confirm.title")
|
||||
:message (t locale "modals.remove-shared-confirm.message" (:name file))
|
||||
:message ""
|
||||
:title (t locale "modals.remove-shared-confirm.message" (:name file))
|
||||
:hint (t locale "modals.remove-shared-confirm.hint")
|
||||
:cancel-label ""
|
||||
:accept-label (t locale "modals.remove-shared-confirm.accept")
|
||||
:on-accept del-shared}))))
|
||||
|
||||
|
|
|
@ -107,10 +107,12 @@
|
|||
(mf/deps file)
|
||||
(st/emitf (modal/show
|
||||
{:type :confirm
|
||||
:message (t locale "modals.add-shared-confirm.message" (:name file))
|
||||
:title (t locale "modals.add-shared-confirm.title")
|
||||
:message ""
|
||||
:title (t locale "modals.add-shared-confirm.message" (:name file))
|
||||
:hint (t locale "modals.add-shared-confirm.hint")
|
||||
:cancel-label ""
|
||||
:accept-label (t locale "modals.add-shared-confirm.accept")
|
||||
:accept-style :primary
|
||||
:on-accept add-shared-fn})))
|
||||
|
||||
on-remove-shared
|
||||
|
@ -118,9 +120,10 @@
|
|||
(mf/deps file)
|
||||
(st/emitf (modal/show
|
||||
{:type :confirm
|
||||
:title (t locale "modals.remove-shared-confirm.title")
|
||||
:message (t locale "modals.remove-shared-confirm.message" (:name file))
|
||||
:message ""
|
||||
:title (t locale "modals.remove-shared-confirm.message" (:name file))
|
||||
:hint (t locale "modals.remove-shared-confirm.hint")
|
||||
:cancel-label ""
|
||||
:accept-label (t locale "modals.remove-shared-confirm.accept")
|
||||
:on-accept del-shared-fn})))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue