From 3064000a2c12197c4b4f085e2994a3f7286c4b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Wed, 14 Oct 2020 08:59:44 +0200 Subject: [PATCH] :sparkles: Change copy texts and style of library dialogs --- frontend/resources/locales.json | 12 ---------- .../resources/styles/main/partials/modal.scss | 22 ++++++++++++----- frontend/src/app/main/ui/confirm.cljs | 24 ++++++++++++++----- frontend/src/app/main/ui/dashboard/grid.cljs | 11 +++++---- .../src/app/main/ui/workspace/header.cljs | 11 +++++---- 5 files changed, 48 insertions(+), 32 deletions(-) diff --git a/frontend/resources/locales.json b/frontend/resources/locales.json index 3b76589f6b..c5923bc1f2 100644 --- a/frontend/resources/locales.json +++ b/frontend/resources/locales.json @@ -1155,12 +1155,6 @@ "es" : "Añadir “%s” como Biblioteca Compartida" } }, - "modals.add-shared-confirm.title" : { - "used-in" : [ "src/app/main/ui/workspace/header.cljs:111", "src/app/main/ui/dashboard/grid.cljs:113" ], - "translations" : { - "en" : "Adding shared library" - } - }, "modals.change-email.confirm-email" : { "used-in" : [ "src/app/main/ui/settings/change_email.cljs:103" ], "translations" : { @@ -1413,12 +1407,6 @@ "es" : "Añadir “%s” como Biblioteca Compartida" } }, - "modals.remove-shared-confirm.title" : { - "used-in" : [ "src/app/main/ui/workspace/header.cljs:121", "src/app/main/ui/dashboard/grid.cljs:126" ], - "translations" : { - "en" : "Unshare file" - } - }, "notifications.profile-deletion-not-allowed" : { "used-in" : [ "src/app/main/ui/settings/delete_account.cljs:28" ], "translations" : { diff --git a/frontend/resources/styles/main/partials/modal.scss b/frontend/resources/styles/main/partials/modal.scss index 4564f54a0b..60e97f52be 100644 --- a/frontend/resources/styles/main/partials/modal.scss +++ b/frontend/resources/styles/main/partials/modal.scss @@ -177,16 +177,26 @@ } .accept-button { - border: 1px solid $color-danger; border-radius: 3px; - background: $color-danger; - color: $color-white; cursor: pointer; - padding: 0.5rem 1rem; - &:hover { - background: $color-danger-dark; + &.danger { + background: $color-danger; + border: 1px solid $color-danger; + color: $color-white; + &:hover { + background: $color-danger-dark; + } + } + + &.primary { + background: $color-primary; + border: 1px solid $color-primary; + color: $color-black; + &:hover { + background: $color-primary-dark; + } } } diff --git a/frontend/src/app/main/ui/confirm.cljs b/frontend/src/app/main/ui/confirm.cljs index 0b86606467..e5dc90c280 100644 --- a/frontend/src/app/main/ui/confirm.cljs +++ b/frontend/src/app/main/ui/confirm.cljs @@ -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}]]]]])) diff --git a/frontend/src/app/main/ui/dashboard/grid.cljs b/frontend/src/app/main/ui/dashboard/grid.cljs index cf7848593f..ce3d053a58 100644 --- a/frontend/src/app/main/ui/dashboard/grid.cljs +++ b/frontend/src/app/main/ui/dashboard/grid.cljs @@ -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})))) diff --git a/frontend/src/app/main/ui/workspace/header.cljs b/frontend/src/app/main/ui/workspace/header.cljs index 3c7ef5f82c..bc8f460f62 100644 --- a/frontend/src/app/main/ui/workspace/header.cljs +++ b/frontend/src/app/main/ui/workspace/header.cljs @@ -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})))