Просмотр исходного кода

enhance(mobile): clickable link item for the left sidebar item

charlie 4 месяцев назад
Родитель
Сommit
059261c63c

+ 5 - 4
src/main/frontend/components/container.cljs

@@ -135,16 +135,17 @@
     ;; TODO: move to standalone component
       [:a.link-item.group
        (cond->
-        {:on-click
+        {(if (util/mobile?)
+           :on-pointer-up :on-click)
          (fn [e]
            (if (gobj/get e "shiftKey")
              (open-in-sidebar)
              (route-handler/redirect-to-page! (:block/uuid page) {:click-from-recent? recent?})))
          :on-context-menu (fn [^js e]
                             (shui/popup-show! e (x-menu-content)
-                                              {:as-dropdown? true
-                                               :content-props {:on-click (fn [] (shui/popup-hide!))
-                                                               :class "w-60"}})
+                              {:as-dropdown? true
+                               :content-props {:on-click (fn [] (shui/popup-hide!))
+                                               :class "w-60"}})
                             (util/stop e))}
          (ldb/object? page)
          (assoc :title (block-handler/block-unique-title page)))

+ 4 - 0
src/main/mobile/components/app.css

@@ -81,6 +81,10 @@ ul {
   }
 }
 
+a, button {
+  -webkit-tap-highlight-color: transparent;
+}
+
 .bg-background {
   @apply bg-gray-01;
 }

+ 4 - 3
src/main/mobile/components/left_sidebar.cljs

@@ -23,8 +23,9 @@
             [:div.w-full.app-silk-popup-content-inner.p-2
              [:div.left-sidebar-inner
               [:div.sidebar-contents-container.mt-8
-               {:on-click (fn [^js e]
-                            (when (some-> (.-target e) (.closest ".link-item"))
-                              (mobile-state/toggle-left-sidebar!)))}
+               {:on-pointer-down
+                (fn [^js e]
+                  (when (some-> (.-target e) (.closest ".link-item"))
+                    (mobile-state/toggle-left-sidebar!)))}
                (container/sidebar-favorites)
                (container/sidebar-recent-pages)]]]))))))