From 5d95ad6cc60140c4bece96ad276db9d2a90ffdd1 Mon Sep 17 00:00:00 2001 From: holybasil Date: Fri, 24 Nov 2023 11:48:02 +0800 Subject: [PATCH] fix: text overflow on seach modal --- .../Header/Search/Search.module.css | 22 ++++++++++--------- src/components/Header/Search/SearchModal.tsx | 10 +++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/components/Header/Search/Search.module.css b/src/components/Header/Search/Search.module.css index 49570f7df..80f0b935e 100644 --- a/src/components/Header/Search/Search.module.css +++ b/src/components/Header/Search/Search.module.css @@ -6,7 +6,7 @@ top: 65px; left: 0; right: 0; - height: 100vh; + height: calc(100vh - 65px); padding-top: 60px; border-radius: 0; } @@ -14,7 +14,6 @@ #searchModal.large { top: 0; height: fit-content; - max-height: 80vh; background: #fff; position: absolute; border-radius: 24px; @@ -24,7 +23,7 @@ .resultsWrapper { padding: 20px 20px 1rem; - overflow: overlay; + height: calc(100% - 50px); } .searchInput { @@ -129,11 +128,6 @@ box-sizing: content-box; } -.hitWrapper { - max-height: 40vh; - overflow: overlay; -} - .hitWrapper ol { list-style: none; } @@ -147,6 +141,9 @@ .queryResults { display: grid; grid-template-columns: 1fr; + grid-auto-rows: max-content; + height: 100%; + overflow-y: auto; } .queryResults h6 { @@ -224,8 +221,8 @@ } .hitWrapper { - max-height: calc(80vh - 100px); - overflow: auto; + max-height: calc(80vh - 150px); + overflow-y: auto; } .hitList li { @@ -259,4 +256,9 @@ .resultsWrapper * { padding-left: 0 !important; } + + .queryResults.large { + max-height: calc(80vh - 48px); + height: max-content; + } } diff --git a/src/components/Header/Search/SearchModal.tsx b/src/components/Header/Search/SearchModal.tsx index 8e88e4ff4..81f52428e 100644 --- a/src/components/Header/Search/SearchModal.tsx +++ b/src/components/Header/Search/SearchModal.tsx @@ -29,14 +29,15 @@ const recommendedArticles = [ }, ] -function EmptyQueryBoundary({ children, fallback }) { +function EmptyQueryBoundary({ children, size, fallback }) { const { indexUiState } = useInstantSearch() const recentArticles = JSON.parse(localStorage.getItem("recentArticles") || "[]") + console.log(indexUiState, "indexUiState") if (!indexUiState.query) { return ( -
+
Recommended articles
@@ -108,6 +109,7 @@ function NoResultsBoundary({ children }) { function CustomHits({ title, hitClassName, ...props }: UseHitsProps & { title: string; hitClassName?: string }) { const { hits, results } = useHits(props) + console.log(hits, "hits") if (hits.length === 0) return null return (
@@ -150,9 +152,9 @@ export function SearchModal({ size = "mini", isOpen, onClose }: { size: Size; is
- + -
+