enhance(ui): support hide close button option for the shui dialog

experiment/tanstack-table
charlie 2024-06-26 10:01:54 +08:00
parent 0c2dd53c2f
commit d278067f8c
5 changed files with 19 additions and 11 deletions

View File

@ -113,9 +113,10 @@
;; components
(rum/defc modal-inner
[config]
(let [{:keys [id title description content footer on-open-change align open? auto-width? root-props content-props]} config
(let [{:keys [id title description content footer on-open-change align open?
auto-width? close-btn? root-props content-props]} config
props (dissoc config
:id :title :description :content :footer auto-width?
:id :title :description :content :footer :auto-width? :close-btn?
:align :on-open-change :open? :root-props :content-props)
props (assoc-in props [:overlay-props :data-align] (name (or align :center)))]
@ -144,7 +145,8 @@
(.preventDefault e))))]
(dialog-content
(cond-> (merge props content-props)
auto-width? (assoc :data-auto-width true))
auto-width? (assoc :data-auto-width true)
(false? close-btn?) (assoc :data-close-btn false))
(when title
(dialog-header
(when title (dialog-title title))

View File

@ -242,6 +242,12 @@ html[data-theme=dark] {
&[data-auto-width] {
@apply max-w-[90vw] w-max sm:max-w-[960px];
}
&[data-close-btn=false] {
.ui__dialog-close {
@apply hidden;
}
}
}
.ui__button-shortcut-key {

View File

@ -2,6 +2,7 @@
(:require
[clojure.set :refer [difference]]
[clojure.string :as string]
[logseq.shui.ui :as shui]
[rum.core :as rum]
[frontend.state :as state]
[frontend.context.i18n :refer [t]]
@ -129,7 +130,7 @@
(set-dir! name dir exts))))
confirm-dir (fn [dir set-dir!]
(state/set-sub-modal!
(shui/dialog-open!
#(confirm-dir-with-alias-name dir set-dir!)))]
[:div.cp__assets-alias-directories

View File

@ -815,10 +815,10 @@
([] (open-icloud-graph-clone-picker (state/get-current-repo)))
([repo]
(when (and repo (mobile-util/in-iCloud-container-path? repo))
(state/set-modal!
(shui/dialog-open!
(fn [close-fn]
(clone-local-icloud-graph-panel repo (util/node-path.basename repo) close-fn))
{:close-btn? false :center? true}))))
{:close-btn? false}))))
(defn make-onboarding-panel
[type]

View File

@ -981,7 +981,7 @@
(ui/button [:span (t :plugin/install)]
:on-click #(do
(plugin-config-handler/replace-plugins plugins)
(state/close-sub-modal! "ls-plugins-from-file-modal")))]]
(shui/dialog-close! "ls-plugins-from-file-modal")))]]
;; all done
[:div.py-4 [:strong.text-xl (str "\uD83C\uDF89 " (t :plugin.install-from-file/success))]])])
@ -1414,11 +1414,10 @@
(defn open-plugins-from-file-modal!
[plugins]
(state/set-sub-modal!
(fn [_close!]
(shui/dialog-open!
(fn []
(plugins-from-file plugins))
{:center? true
:id "ls-plugins-from-file-modal"}))
{:id "ls-plugins-from-file-modal"}))
(defn open-focused-settings-modal!
[title]