Browse Source

enhance: delete btn for the date property picker

charlie 1 year ago
parent
commit
d55b07b0ba

+ 2 - 2
resources/css/shui.css

@@ -388,8 +388,8 @@ div[data-radix-popper-content-wrapper] {
   }
 
   .del-date-btn {
-    @apply absolute right-[9px] top-[19px] px-1 opacity-70 hover:opacity-100
-    active:opacity-80 hover:text-red-rx-09 rounded-md;
+    @apply absolute right-[13px] top-[21px] px-1 opacity-70 hover:opacity-100
+    active:opacity-80 hover:text-red-rx-09 rounded-md !h-6 !w-6;
   }
 
   &.has-del-btn {

+ 4 - 2
src/main/frontend/components/property/value.cljs

@@ -187,7 +187,7 @@
                    (shui/dialog-close!)
                    (state/set-editor-action! nil)
                    state)}
-  [state id {:keys [on-change value _del-btn? _on-delete]}]
+  [state id {:keys [on-change value del-btn? on-delete]}]
   (let [*ident (::identity state)
         initial-day (or (some-> value (.getTime) (js/Date.)) (js/Date.))
         initial-month (when value
@@ -212,6 +212,8 @@
       {:initial-focus true
        :selected initial-day
        :id @*ident
+       :del-btn? del-btn?
+       :on-delete on-delete
        :on-day-click select-handler!}
        initial-month
        (assoc :default-month initial-month)))))
@@ -273,7 +275,7 @@
                       (property-handler/set-block-property! repo (:block/uuid block)
                         (:db/ident property)
                         (:db/id page)))
-         :del-btn? (not value)
+         :del-btn? (some-> value (:block/title) (boolean))
          :on-delete (fn []
                       (property-handler/set-block-property! repo (:block/uuid block)
                         (:db/ident property) nil)

+ 1 - 1
src/main/frontend/ui.cljs

@@ -1131,7 +1131,7 @@
 (rum/defc DelDateButton
   [on-delete]
   (shui/button {:variant :outline :size :sm :class "del-date-btn" :on-click on-delete}
-    (shui/tabler-icon "trash")))
+    (shui/tabler-icon "trash" {:size 15})))
 
 (defonce month-values
   [:January :February :March :April :May