Skip to content

Commit 57252c8

Browse files
authored
Merge pull request #4293 from ClickHouse/4228-improve-search-usability
Showing More Search Results, Expanding modal size
2 parents cbbf76a + e6eeb96 commit 57252c8

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/theme/SearchBar/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ function DocSearch({ contextualSearch, externalUrlRegex, ...props }) {
2727
const { siteMetadata, i18n: { currentLocale } } = useDocusaurusContext();
2828
const processSearchResultUrl = useSearchResultUrlProcessor();
2929
const contextualSearchFacetFilters = useAlgoliaContextualFacetFilters();
30+
const configFacetFilters = props.searchParameters?.facetFilters ?? [];
31+
const facetFilters = contextualSearch
32+
? // Merge contextual search filters with config filters
33+
mergeFacetFilters(contextualSearchFacetFilters, configFacetFilters)
34+
: // ... or use config facetFilters
35+
configFacetFilters;
36+
// We add clickAnalyics here
37+
const searchParameters = {
38+
...props.searchParameters,
39+
facetFilters,
40+
clickAnalytics: true,
41+
hitsPerPage: 10,
42+
};
3043
const { isAskAIOpen, currentMode } = useAskAI();
3144
const history = useHistory();
3245
const searchButtonRef = useRef(null);

src/theme/SearchBar/styles.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,25 @@
6161
.DocSearch-Logo {
6262
display: none !important;
6363
}
64+
65+
.DocSearch-Dropdown {
66+
max-height: calc(min(90vh) - 180px) !important;
67+
}
68+
69+
/* Mobile styles */
70+
@media (max-width: 768px) {
71+
.DocSearch-Dropdown {
72+
max-height: calc(100vh - 120px) !important;
73+
width: calc(100vw - 20px) !important;
74+
left: 10px !important;
75+
right: 10px !important;
76+
position: fixed !important;
77+
z-index: 9999 !important;
78+
}
79+
80+
.DocSearch-SearchBar {
81+
position: sticky !important;
82+
top: 0 !important;
83+
z-index: 10000 !important;
84+
}
85+
}

0 commit comments

Comments
 (0)