From 07ce96cedd8bba4f74d60d73e1b1fa9f422039b8 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Thu, 10 Nov 2022 21:15:59 +0800 Subject: [PATCH] fix: hide search in page on narrow screens --- .../frontend/components/command_palette.css | 9 ----- src/main/frontend/components/search.cljs | 39 ++++++++++--------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/main/frontend/components/command_palette.css b/src/main/frontend/components/command_palette.css index 6b7a4cef3..9af527312 100644 --- a/src/main/frontend/components/command_palette.css +++ b/src/main/frontend/components/command_palette.css @@ -37,15 +37,6 @@ height: var(--palettle-input-height); } - .recent-search { - > .wrap { - > div:last-child { - display: flex !important; - justify-items: center; - } - } - } - .cp__palette-input { color: var(--ls-secondary-text-color); border: none; diff --git a/src/main/frontend/components/search.cljs b/src/main/frontend/components/search.cljs index 36b5e0b11..cd9e6fbae 100644 --- a/src/main/frontend/components/search.cljs +++ b/src/main/frontend/components/search.cljs @@ -310,24 +310,25 @@ [:div.recent-search [:div.wrap.px-4.py-2.text-sm.opacity-70.flex.flex-row.justify-between.align-items.mx-1.sm:mx-0 [:div "Recent search:"] - (ui/with-shortcut :go/search-in-page "bottom" - [:div.flex-row.flex.align-items - [:div.mr-3.flex "Search blocks in page:"] - [:div.flex.items-center - (ui/toggle in-page-search? - (fn [_value] - (state/set-search-mode! (if in-page-search? :global :page))) - true)] - (ui/tippy {:html [:div - ;; TODO: fetch from config - "Tip: " [:code (util/->platform-shortcut "Ctrl + Shift + p")] " to open the commands palette"] - :interactive true - :arrow true - :theme "monospace"} - [:a.flex.fade-link.items-center - {:style {:margin-left 12} - :on-click #(state/toggle! :ui/command-palette-open?)} - (ui/icon "command" {:style {:font-size 20}})])])] + [:div.hidden.md:flex + (ui/with-shortcut :go/search-in-page "bottom" + [:div.flex-row.flex.align-items + [:div.mr-3.flex "Search blocks in page:"] + [:div.flex.items-center + (ui/toggle in-page-search? + (fn [_value] + (state/set-search-mode! (if in-page-search? :global :page))) + true)] + (ui/tippy {:html [:div + ;; TODO: fetch from config + "Tip: " [:code (util/->platform-shortcut "Ctrl + Shift + p")] " to open the commands palette"] + :interactive true + :arrow true + :theme "monospace"} + [:a.flex.fade-link.items-center + {:style {:margin-left 12} + :on-click #(state/toggle! :ui/command-palette-open?)} + (ui/icon "command" {:style {:font-size 20}})])])]] (let [recent-search (mapv (fn [q] {:type :search :data q}) (db/get-key-value :recent/search)) pages (->> (db/get-key-value :recent/pages) (remove nil?) @@ -407,7 +408,7 @@ timeout 300 in-page-search? (= search-mode :page)] [:div.cp__palette.cp__palette-main - [:div.ls-search + [:div.ls-search.p-2 [:div.input-wrap [:input.cp__palette-input.w-full {:type "text"