1
0
mirror of https://github.com/minio/docs.git synced 2025-04-18 10:04:02 +03:00

Replace Algolia DocSearch with InstantSearch (#621)

- Rendered only the relevant search results that has the match-level of
either `full` or `partial`.
- Added refinements to display results from other platforms (Active
platform is selected by default).
- Better title and hierarchical display.

![title](https://user-images.githubusercontent.com/13393018/198229684-3018b591-a54c-4b4f-80db-94c11e33ec65.svg)


- Added icons to represent the hierarchy level.

![icons](https://user-images.githubusercontent.com/13393018/198228150-143153bf-aa9a-4c41-baf8-bd9fa3d33bf2.png)
- Relevant results on full/partial match queries.
<img width="595" alt="Screenshot 2022-10-27 at 12 09 26"
src="https://user-images.githubusercontent.com/13393018/198228440-3a7b52a6-9f33-4778-a2ab-15b1454ede99.png">

- TODO: Keyboard shortcut to trigger/focus the search modal. (Will
address this with a new PR)
This commit is contained in:
Rushan 2022-11-02 18:21:21 +04:00 committed by GitHub
parent b5b345ae6f
commit 594a9cfb6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 762 additions and 235 deletions

View File

@ -46,7 +46,7 @@ gulp.task('handleStyle', function() {
// Minify and move JS
gulp.task('handleJs', function() {
return gulp.src (paths.js.main)
return gulp.src (paths.js.files)
.pipe($.terser())
.pipe(gulp.dest (paths.js.dist))
.pipe(connect.reload());

View File

@ -0,0 +1 @@
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><title>Group</title><path d="M11.623 11.623 15 15l-3.377-3.377a6.223 6.223 0 1 1-8.8-8.8 6.223 6.223 0 0 1 8.8 8.8Z" stroke="#A2ADC0" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"/></svg>

After

Width:  |  Height:  |  Size: 302 B

View File

@ -0,0 +1 @@
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><title>Group</title><path d="M11.623 11.623 15 15l-3.377-3.377a6.223 6.223 0 1 1-8.8-8.8 6.223 6.223 0 0 1 8.8 8.8Z" stroke="#000" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"/></svg>

After

Width:  |  Height:  |  Size: 299 B

View File

@ -0,0 +1,356 @@
window.addEventListener("DOMContentLoaded", () => {
const searchToggleEl = document.querySelectorAll(".search-toggle");
const searchModalEl = document.getElementById("search");
const root = document.documentElement;
// Get the current doc platform
const activePlatform = document
.getElementsByTagName("meta")
["docsearch:platform"].getAttribute("content");
// SVG Icons
const icons = {
h1: `<svg width="14" height="9">
<path d="M1.259 9a.5.5 0 0 1-.5-.5V.773a.5.5 0 0 1 .5-.5h.845a.5.5 0 0 1 .5.5v3.001a.1.1 0 0 0 .1.1H6.25a.1.1 0 0 0 .1-.1V.773a.5.5 0 0 1 .5-.5h.841a.5.5 0 0 1 .5.5V8.5a.5.5 0 0 1-.5.5H6.85a.5.5 0 0 1-.5-.5V5.495a.1.1 0 0 0-.1-.1H2.704a.1.1 0 0 0-.1.1V8.5a.5.5 0 0 1-.5.5h-.845zM12.957.273a.5.5 0 0 1 .5.5V8.5a.5.5 0 0 1-.5.5h-.845a.5.5 0 0 1-.5-.5V2.064a.04.04 0 0 0-.04-.04h0a.04.04 0 0 0-.021.006l-1.223.767a.5.5 0 0 1-.766-.424v-.458a.5.5 0 0 1 .233-.422L11.601.35a.5.5 0 0 1 .268-.078h1.089z"/>
</svg>`,
h2: `<svg width="16" height="9">
<path d="M1.259 9a.5.5 0 0 1-.5-.5V.773a.5.5 0 0 1 .5-.5h.845a.5.5 0 0 1 .5.5v3.001a.1.1 0 0 0 .1.1H6.25a.1.1 0 0 0 .1-.1V.773a.5.5 0 0 1 .5-.5h.841a.5.5 0 0 1 .5.5V8.5a.5.5 0 0 1-.5.5H6.85a.5.5 0 0 1-.5-.5V5.495a.1.1 0 0 0-.1-.1H2.704a.1.1 0 0 0-.1.1V8.5a.5.5 0 0 1-.5.5h-.845zm8.902 0a.5.5 0 0 1-.5-.5v-.611a.5.5 0 0 1 .16-.367l2.946-2.728.665-.69a2.62 2.62 0 0 0 .413-.601 1.49 1.49 0 0 0 .141-.643 1.21 1.21 0 0 0-.175-.661c-.117-.185-.276-.331-.477-.43s-.43-.153-.686-.153c-.267 0-.5.054-.699.162a1.12 1.12 0 0 0-.46.464c-.038.071-.069.146-.094.227-.081.264-.292.493-.568.493h-.751c-.276 0-.505-.225-.464-.498.055-.366.172-.696.352-.989A2.59 2.59 0 0 1 11.05.499c.466-.23 1.003-.345 1.611-.345.625 0 1.169.111 1.632.332a2.59 2.59 0 0 1 1.087.912c.258.389.388.835.388 1.338a2.56 2.56 0 0 1-.196.976c-.131.321-.357.678-.686 1.07s-.794.857-1.393 1.402l-1.274 1.249v.06h3.165a.5.5 0 0 1 .5.5V8.5a.5.5 0 0 1-.5.5h-5.222z"/>
</svg>`,
h3: `<svg width="17" height="10">
<path d="M1.259 9a.5.5 0 0 1-.5-.5V.773a.5.5 0 0 1 .5-.5h.845a.5.5 0 0 1 .5.5v3.001a.1.1 0 0 0 .1.1H6.25a.1.1 0 0 0 .1-.1V.773a.5.5 0 0 1 .5-.5h.841a.5.5 0 0 1 .5.5V8.5a.5.5 0 0 1-.5.5H6.85a.5.5 0 0 1-.5-.5V5.495a.1.1 0 0 0-.1-.1H2.704a.1.1 0 0 0-.1.1V8.5a.5.5 0 0 1-.5.5h-.845zm11.627.119c-.636 0-1.203-.109-1.7-.328s-.885-.526-1.172-.912a2.24 2.24 0 0 1-.381-.842c-.06-.273.171-.504.451-.504h.875c.266 0 .471.221.606.45a.99.99 0 0 0 .077.112c.131.159.304.283.52.371s.459.132.729.132c.281 0 .53-.05.746-.149a1.22 1.22 0 0 0 .507-.413c.122-.176.183-.379.183-.609a1.02 1.02 0 0 0-.196-.618c-.128-.182-.312-.324-.554-.426s-.523-.153-.852-.153h-.314a.5.5 0 0 1-.5-.5v-.355a.5.5 0 0 1 .5-.5h.314a1.77 1.77 0 0 0 .737-.145c.216-.097.383-.23.503-.401a1.04 1.04 0 0 0 .179-.605c0-.219-.053-.411-.158-.575a1.04 1.04 0 0 0-.435-.392c-.185-.094-.401-.141-.648-.141a1.69 1.69 0 0 0-.686.136 1.2 1.2 0 0 0-.499.379.98.98 0 0 0-.077.119c-.13.235-.335.461-.604.461h-.779c-.279 0-.511-.232-.45-.504.067-.3.191-.575.372-.825.278-.384.653-.683 1.125-.899s1.01-.328 1.607-.328c.602 0 1.129.109 1.581.328s.803.514 1.053.886a2.15 2.15 0 0 1 .375 1.244c.003.489-.149.896-.456 1.223a2.08 2.08 0 0 1-1.189.622v.068c.642.082 1.131.305 1.466.669s.506.813.503 1.355a2.13 2.13 0 0 1-.43 1.325c-.287.386-.683.69-1.189.912s-1.085.332-1.739.332z"/>
</svg>`,
content: `<svg width="15" height="10">
<path d="M0 .75A.75.75 0 0 1 .75 0h13.5a.75.75 0 1 1 0 1.5H.75A.75.75 0 0 1 0 .75zm0 4A.75.75 0 0 1 .75 4h13.5a.75.75 0 1 1 0 1.5H.75A.75.75 0 0 1 0 4.75zm0 4A.75.75 0 0 1 .75 8h13.5a.75.75 0 1 1 0 1.5H.75A.75.75 0 0 1 0 8.75z"/>
</svg>`,
noResult: `<svg width="56" height="56">
<path d="M44.26 12.728c5.903 8.844 5.017 20.636-2.951 28.595h0L54 54 41.309 41.324c-7.722 7.709-19.803 8.94-28.924 2.948m-6.493-6.486C-.178 28.73.95 16.663 8.593 8.887S28.295-.24 37.472 5.653M4.415 51.642L51.639 4.474" stroke="currentColor" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round" />
</svg>`,
chevron: `<svg viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>`,
};
// Detect macOS
function isMac() {
return navigator.platform.toUpperCase().indexOf("MAC") >= 0;
}
// Algolia credintials
const algoliaClient = algoliasearch(
"E1CSOK3UC2",
"6bc246d81fd3b79f51cf88f0b2481bac"
);
// By default, Instantsearch will display the latest hits even without a query.
// As per our design, we don't need this behaviour.
// So, use promise to conditionally render the search results.
const searchClient = {
...algoliaClient,
search(requests) {
if (requests.every(({ params }) => !params.query)) {
return Promise.resolve({
results: requests.map(() => ({
hits: [],
nbHits: 0,
nbPages: 0,
page: 0,
processingTimeMS: 0,
hitsPerPage: 0,
exhaustiveNbHits: false,
query: "",
params: "",
})),
});
}
return algoliaClient.search(requests);
},
};
// Init Instantsearch
const search = instantsearch({
indexName: "minio",
searchClient,
initialUiState: {
minio: {
refinementList: {
platform: [activePlatform],
},
},
},
});
// Add Instanstsearch widgets
search.addWidgets([
instantsearch.widgets.searchBox({
container: "#search-box",
autofocus: true,
showReset: false,
showSubmit: false,
placeholder: "Search Documentation",
cssClasses: {
input: "search__input",
reset: "search__reset",
form: "search__form",
loadingIndicator: "search__loading",
},
queryHook(query, search) {
if (query !== "") {
// Make search modal active
searchModalEl.classList.add("search--focused");
// Clear the filters and select the active platform
setTimeout(() => {
const activeFilterEl = document.querySelector(".search__filters__checkbox[value='" + activePlatform + "']");
if (activeFilterEl && !activeFilterEl.checked) {
activeFilterEl.click();
}
}, 50);
} else {
// Make search modal inactive
searchModalEl.classList.remove("search--focused");
// Clear the filters
clearRefinements();
}
// Clear the filters on x click
document.querySelector(".search__reset").addEventListener("click", () => {
clearRefinements();
});
// Fire the search
search(query);
},
}),
instantsearch.widgets.poweredBy({
container: "#search-powered-by",
cssClasses: {
link: "search__powered-by",
},
}),
instantsearch.widgets.refinementList({
container: "#search-filters",
attribute: "platform",
cssClasses: {
root: "search__filters",
noRefinementRoot: "search__filters--empty",
list: "search__filters__list",
labelText: "search__filters__label",
checkbox: "search__filters__checkbox",
count: "search__filters__count",
},
}),
instantsearch.widgets.clearRefinements({
container: "#search-clear",
cssClasses: {
button: "search-clear__btn",
},
}),
instantsearch.widgets.hits({
container: "#search-results",
cssClasses: {
root: "search__hits",
emptyRoot: "search__hits--empty",
list: "search__hits__list",
item: "search__hits__item",
},
templates: {
empty: `<div>
${icons.noResult}</br>
No results have been found for <span>{{ query }}</span>.</br>
Please rephrase your query!
</div>`,
item: function (data) {
var returnString;
var docUrl;
var refinedLenth =
search.renderState.minio.refinementList.platform.items.filter(
(x) => x.isRefined
).length;
if (refinedLenth !== 1) {
searchModalEl.classList.add("search--show-platform");
} else {
searchModalEl.classList.remove("search--show-platform");
}
// If the query is a full-match of a lvl1 title,
// display only the h1.
if (
data.hierarchy.lvl1 &&
data._highlightResult.hierarchy.lvl1.matchLevel === "full"
) {
docUrl = data.url_without_anchor;
returnString = `
<i class="search__hits__icon">
${icons.h1}
</i>
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl1.value}</div>
<div class="search__hits__platform">${data.platform}</div>
`;
}
// If the query is a full-match of a lvl2 title,
// display h2 as the title and h1 as the sub-text.
else if (
data.hierarchy.lvl2 &&
data._highlightResult.hierarchy.lvl2.matchLevel === "full"
) {
docUrl = data.url;
returnString = `
<i class="search__hits__icon">
${icons.h2}
</i>
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl2.value}</div>
<div class="search__hits__label">
<div class="search__hits__platform">${data.platform}</div>
${data.hierarchy.lvl1}
</div>
`;
}
// If the query is a full-match of a lvl3 title,
// display h3 as the title and h1, h2 as the sub-text.
else if (
data.hierarchy.lvl3 &&
data._highlightResult.hierarchy.lvl3.matchLevel === "full"
) {
docUrl = data.url;
returnString = `
<i class="search__hits__icon">
${icons.h3}
</i>
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl3.value}</div>
<div class="search__hits__label">
<div class="search__hits__platform">${data.platform}</div>
${data.hierarchy.lvl1}
</div>
`;
}
// If the query is a full-match of any content,
// display the content as the title and h1, h2? and h3? as the sub-text.
else if (
data.hierarchy.lvl1 &&
data._snippetResult &&
data._snippetResult.content.matchLevel !== "none"
) {
docUrl = data.url;
returnString = `
<i class="search__hits__icon">
${icons.content}
</i>
<div class="search__hits__title">${
data._snippetResult.content.value
}</div>
<div class="search__hits__label">
<div class="search__hits__platform">${data.platform}</div>
<span>${data.hierarchy.lvl1}</span>
${
data.hierarchy.lvl2
? `${icons.chevron}` +
`<span>${data.hierarchy.lvl2}</span>`
: ""
}
${
data.hierarchy.lvl3
? `${icons.chevron}` +
`<span>${data.hierarchy.lvl3}</span>`
: ""
}
</div>
`;
} else {
return false;
}
return `<a target="_blank" href="${docUrl}">
${returnString}
</a>`;
},
},
}),
]);
// Function to clear search field and filters
function clearRefinements() {
const filtersClearEl = document.querySelector("#search-clear .search-clear__btn");
filtersClearEl?.click();
root.classList.remove("locked");
searchModalEl.classList.remove("search--active", "search--focused");
}
// Function to close and reset the search modal
function closeSearchModal() {
const searchResetEl = document.querySelector(".search__reset");
setTimeout(() => {
searchResetEl.click();
});
}
// Toggle search modal on read-mode and mobile
// on search icon click.
searchToggleEl.forEach((item) => {
item.addEventListener("click", (e) => {
e.preventDefault();
root.classList.add("locked");
searchModalEl.classList.add("search--active");
setTimeout(() => {
const instaSearchInputEl = document.querySelector(".search__input");
instaSearchInputEl.focus();
});
});
});
// Keyboard events
document.addEventListener(
"keydown",
(e) => {
// Close the search on esc key press
if (e.key === "Escape") {
closeSearchModal();
}
// Focus the search input on "Meta + K" key press
const searchInputEl = document.querySelector(".search__input");
var metaKey = isMac() ? e.metaKey : e.ctrlKey;
if (metaKey && e.key === "k") {
if (root.classList.contains("read-mode")) {
searchModalEl.classList.add("search--active");
searchInputEl.focus();
}
searchInputEl.focus();
window.scrollTo(0, 0);
}
},
false
);
// Start the search
search.start();
// --------------------------------------------------
// Trigger search on keyboard shortcut
// meta + k
// --------------------------------------------------
const searchEl = document.getElementById("search-box");
if (searchEl) {
const metaKeyEl = document.createElement("i");
metaKeyEl.classList.add("search__meta-key");
if (isMac) {
metaKeyEl.classList.add("macos");
metaKeyEl.innerHTML = "⌘K";
} else {
metaKeyEl.classList.add("non-macos");
metaKeyEl.innerHTML = "Ctrl K";
}
searchEl.appendChild(metaKeyEl);
}
});

View File

@ -350,39 +350,6 @@ window.addEventListener("DOMContentLoaded", (event) => {
}
})();
// --------------------------------------------------
// Search
// --------------------------------------------------
(function () {
const docSearchEl = document.getElementById("docsearch");
const platform = document.head.querySelector('meta[name="docsearch:platform"]').content
if(docSearchEl) {
// Init Docsearch
docsearch({
container: '#docsearch',
appId: 'E1CSOK3UC2',
indexName: 'minio',
apiKey: '6bc246d81fd3b79f51cf88f0b2481bac',
placeholder: 'Search Documentation',
searchParameters: {
facetFilters: ['platform:' + platform]
}
});
// Trigger Docsearch modal on custom button clicks
const searchToggleEls = document.querySelectorAll(".search-toggle");
const docSearchBtn = document.querySelector(".DocSearch-Button");
searchToggleEls.forEach(item => {
item.addEventListener("click", (event) => {
event.preventDefault();
docSearchBtn.click();
});
});
}
})();
// --------------------------------------------------
// Custom scrollbars for `pre` code blocks
// --------------------------------------------------

View File

@ -35,7 +35,7 @@
}
}
.header__title {
.header__top__title {
line-height: 100%;
font-weight: 500;
color: var(--header-headings-color);
@ -50,6 +50,7 @@
display: flex;
gap: 0.5rem;
margin-left: auto;
z-index: 1;
.icon {
&:not(.icon--switch) {
@ -87,6 +88,13 @@
}
}
.header__title {
font-size: 2.5rem;
text-align: center;
color: $white;
margin: 3rem 1rem 0;
}
#read-mode-toggle {
@include breakpoint-max(breakpoints(xl)) {
display: none;
@ -97,21 +105,9 @@
&:not(.read-mode) {
.header__actions {
position: absolute;
bottom: 2rem;
bottom: 2.5rem;
right: var(--content-padding);
}
.header__hero {
text-align: center;
padding: 3rem 0 2rem;
& > h2 {
font-size: 2.5rem;
font-weight: $font-weight-bold;
color: var(--header-headings-color);
margin: 0 0 0.75rem;
}
}
}
&.read-mode {

View File

@ -5,6 +5,14 @@
@include breakpoint-max(breakpoints(lg)) {
--content-padding: 1.25rem;
}
&.locked {
&,
body,
.content {
overflow: hidden;
}
}
}
.content {

View File

@ -265,6 +265,13 @@ textarea {
font-family: $font-family-base;
}
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
-webkit-appearance:none;
}
// ----------------------
// Media

View File

@ -1,232 +1,408 @@
@import 'https://cdn.jsdelivr.net/npm/@docsearch/css@3';
:root {
--docsearch-muted-color: var(--text-muted-color);
--docsearch-key-gradient: none;
--docsearch-key-shadow: none;
--docsearch-text-color: var(--text-color);
--docsearch-searchbox-focus-background: var(--ds-search-bg);
--docsearch-modal-shadow: none;
--docsearch-highlight-color: var(--link-color);
--docsearch-hit-shadow: none;
--docsearch-hit-background: transparent;
--docsearch-hit-height: 3rem;
--docsearch-footer-shadow: none;
--docsearch-footer-background: transparent;
--docsearch-hit-color: var(--text-color);
--docsearch-logo-color: var(--text-muted-color);
&:not(.read-mode) {
.search__dropdown {
position: absolute;
top: 100%;
left: 0;
width: 100%;
}
.search--focused {
z-index: 10;
&:before {
content: '';
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: var(--is-container-background);
z-index: -1;
}
}
}
&.read-mode {
#search {
position: fixed;
left: 0;
top: 0;
z-index: 10;
width: 100%;
height: 100%;
background-color: var(--is-container-background);
display: none;
padding: 3rem;
@include breakpoint-max(breakpoints(sm)) {
padding: 1rem;
}
&.search--active {
display: block;
}
}
.search__input {
height: 3.1rem;
}
.search__meta-key {
display: none;
}
}
}
#docsearch {
#search {
padding: 2rem 1rem 2.5rem;
display: flex;
justify-content: center;
isolation: isolate;
position: relative;
}
.DocSearch-Button {
--docsearch-searchbox-shadow: 0 0 0 0.3rem var(--ds-search-focus-shadow);
--docsearch-searchbox-background: var(--ds-search-bg);
border-radius: $border-radius;
width: 100%;
margin: 1rem 0 0 0;
height: 2.75rem;
padding: 0 1rem;
font-family: inherit;
transition: box-shadow 200ms ease-in-out;
.DocSearch-Button-Placeholder {
font-size: 0;
color: var(--ds-search-placeholder-color);
&:before {
content: "Search Documentation";
font-size: $font-size-sm;
font-weight: normal;
}
.search--active,
.search--focused {
.search__reset {
display: grid;
}
}
.DocSearch-Button-Key {
font-family: inherit;
width: auto;
margin: 0;
height: auto;
line-height: 1;
& > svg {
margin-right: 2px;
}
}
.DocSearch-Button-Keys {
min-width: 0;
height: 0;
font-size: 0.7rem;
.search--focused {
.search__dropdown {
display: flex;
opacity: 0.75;
padding-top: 1px;
}
@include breakpoint-min(breakpoints(xl)) {
max-width: 31.5rem;
.search__form {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.search__meta-key {
opacity: 0;
}
}
.DocSearch-Search-Icon {
width: 0.9rem;
margin-right: 0.25rem;
.search__inner {
max-width: 35rem;
width: 100%;
margin: 0 auto;
border-radius: $border-radius-lg;
position: relative;
}
.DocSearch-Modal {
overflow: hidden;
.search__dropdown {
background-color: var(--is-dropdown-bg);
z-index: 10;
flex-direction: column;
border-radius: 0 0 $border-radius-lg $border-radius-lg;
max-height: 23rem;
min-height: 15rem;
display: none;
}
.DocSearch-Form {
--docsearch-searchbox-shadow: none;
--docsearch-highlight-color: var(--text-color);
.search__input {
background: transparent var(--is-search-icon) no-repeat center left 1rem;
background-size: 0.85rem;
border: 0;
appearance: none;
height: 2.75rem;
width: 100%;
padding: 0 1.5rem 0.05rem 2.5rem;
color: var(--text-color);
border-radius: $border-radius;
padding: 0 1.25rem;
border-radius: 0;
}
.DocSearch-SearchBar {
--docsearch-spacing: 0;
background-color: var(--ds-search-bg);
}
.DocSearch-Hit-title {
font-size: $font-size-sm;
text-overflow: ellipsis;
overflow: hidden;
margin-top: 1px;
}
.DocSearch-Hit-action-button,
.DocSearch-Hit-icon,
.DocSearch-Reset,
.DocSearch-MagnifierLabel,
.DocSearch-Hit-action {
& > svg {
width: 0.9rem;
}
}
.DocSearch-Hit-action,
.DocSearch-Hit-icon {
svg {
&::placeholder {
color: var(--text-muted-color);
}
}
.DocSearch-Hit-icon {
width: 2.1rem;
height: 2.1rem;
.search__form {
display: flex;
align-items: center;
background-color: var(--is-search-bg);
border-radius: $border-radius;
display: grid;
place-content: center;
background-color: var(--ds-search-bg);
margin-right: 0.4rem;
}
.DocSearch-Hit-action-button {
opacity: 0.65;
transition: opacity 200ms;
.search__reset {
place-content: center;
width: 1.5rem;
height: 1.5rem;
appearance: none;
border: 0;
background: none;
border-radius: $border-radius-sm;
cursor: pointer;
display: none;
margin-right: 0.75rem;
&:focus,
&:hover {
background-color: var(--theme-light-bg);
}
&:hover,
&:focus {
path {
fill: transparent
& > svg {
width: 0.5rem;
fill: var(--text-color);
}
}
.search__filters {
background-color: var(--is-search-bg);
font-size: $font-size-sm;
&:not(.search__filters--empty) {
.search__filters__list {
padding: 0.75rem 1.25rem 1rem;
}
}
}
&:hover {
background-color: transparent;
opacity: 1;
.search__filters__list {
list-style: none;
padding: 0;
margin: 0;
gap: 0.35rem;
color: var(--text-muted-color);
white-space: nowrap;
overflow-y: auto;
text-align: center;
@include hide-scrollbars();
& > li {
display: inline-block;
& + li {
margin-left: 0.5rem;
}
}
}
.DocSearch-Input {
font-size: $font-size-md;
padding-left: 0.5rem;
.search__filters__label {
border: 1px solid var(--is-refine-list-border-color);
border-radius: $border-radius;
line-height: 100%;
padding: 0.35rem 0.5rem;
font-weight: $font-weight-medium;
font-size: $font-size-xs;
}
.DocSearch-Dropdown {
--docsearch-muted-color: var(--ds-scrollbar-bg);
}
.search__filters__checkbox {
display: none;
.DocSearch-Hits {
mark {
--docsearch-highlight-color: var(--text-color);
text-decoration: underline;
text-underline-offset: 0.15rem;
text-decoration-thickness: 1px;
}
&:last-of-type {
margin-bottom: 1rem;
&:checked {
& ~ .search__filters__label {
background-color: var(--is-refine-list-border-color);
color: var(--text-color);
}
}
}
.DocSearch-Hit-content-wrapper {
font-weight: $font-weight-normal;
.search__filters__count {
display: none;
}
.DocSearch-Hit {
--docsearch-highlight-color: var(--ds-highlight-color);
--docsearch-hit-active-color: var(--text-color);
--docsearch-muted-color: var(--text-muted-color);
#search-results {
flex: 1;
overflow-y: auto;
position: relative;
height: 100%;
@extend .scrollbar;
}
.search__hits__list {
list-style: none;
padding: 1rem;
margin: 0;
text-align: left;
}
.search__hits__item {
position: relative;
& > a {
display: block;
padding: 0 0.75rem 0 3.25rem;
border-radius: $border-radius;
padding-left: 0.5rem;
min-height: 3rem;
margin-bottom: 0.3rem;
display: flex;
flex-direction: column;
justify-content: center;
&:focus,
&:hover {
background-color: var(--is-highlight-color);
}
}
}
.DocSearch-Hits {
&:not(:last-child) {
.search__hits__label,
.search__hits__title {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.search__hits__title {
font-size: $font-size-sm;
color: var(--text-color);
width: 100%;
line-height: 1.1;
& > mark {
font-weight: $font-weight-medium;
background-color: transparent;
color: #0f77bf;
}
}
.search__hits__label {
color: var(--text-muted-color);
font-size: 0.65rem;
display: flex;
align-items: center;
line-height: 1;
margin-top: 0.35rem;
.search__hits__platform {
margin-top: 0;
}
& > svg {
height: 0.8rem;
width: 0.8rem;
stroke: var(--text-muted-color);
margin: 0 0.25rem;
position: relative;
top: 0.03rem;
}
}
.search__hits__icon {
position: absolute;
height: 2.25rem;
width: 2.25rem;
top: 0;
left: 0.4rem;
bottom: 0;
margin: auto 0;
border-radius: $border-radius;
background-color: var(--is-search-bg);
display: grid;
fill: var(--text-muted-color);
place-content: center;
}
.search__hits__platform {
font-size: 0.65rem;
color: var(--text-muted-color);
line-height: 1;
border: 1px solid var(--is-hit-platform-border-color);
border-radius: $border-radius-sm;
padding: 0.1rem 0.2rem;
display: none;
width: fit-content;
margin: 0.4rem 0.35rem 0 0;
}
.search--show-platform {
.search__hits__platform {
display: inline-block;
}
}
.search__hits--empty {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: grid;
place-content: center;
text-align: center;
font-size: $font-size-sm;
color: var(--text-muted-color);
svg {
margin-bottom: 1rem;
}
span {
background: var(--is-highlight-color);
padding: 0.2rem 0.4rem;
border-radius: $border-radius-sm;
color: var(--text-color);
}
}
.DocSearch-Hit-source {
--docsearch-highlight-color: var(--text-muted-color);
.search__powered-by {
padding: 0.75rem 1rem;
display: flex;
align-items: center;
color: var(--text-muted-color);
font-size: $font-size-xs;
justify-content: flex-end;
transition: color 300ms;
font-weight: $font-weight-medium;
font-size: $font-size-sm;
padding: 0.5rem 0.75rem 0.1rem;
&:hover {
color: var(--text-color);
}
&:before {
content: "Search by";
}
& > a {
display: block;
}
svg {
margin-left: -3.5rem;
path {
fill: currentColor;
&:first-child {
display: none;
}
}
}
}
.DocSearch-Hit-path {
--docsearch-hit-active-color: var(--text-muted-color);
font-size: 0.65rem;
#search-clear {
position: absolute;
z-index: -1;
opacity: 0;
pointer-events: none;
}
.DocSearch-Hit-content-wrapper {
margin: 0.25rem;
.search__meta-key {
font-style: normal;
position: absolute;
top: 1rem;
right: 0.9rem;
pointer-events: none;
opacity: 100;
transition: opacity 300ms;
line-height: 1;
font-size: $font-size-xs;
color: var(--text-muted-color);
}
.DocSearch-HitsFooter {
margin-bottom: 0;
padding-bottom: 0;
}
.search__loading {
position: absolute;
top: 0.75rem;
left: 1rem;
background-color: var(--is-search-bg);
.DocSearch-Logo {
transform: scale(0.85);
transform-origin: right;
margin-right: 0.35rem;
opacity: 0.75;
}
svg {
stroke-width: 2px;
.DocSearch-Cancel {
--docsearch-highlight-color: var(--text-muted-color);
font-size: $font-size-sm;
padding-right: 1rem;
}
.DocSearch-NoResults-Prefill-List,
.DocSearch-Commands {
display: none;
circle {
stroke: var(--is-loader-circle-stroke);
}
}
}

View File

@ -8,7 +8,7 @@ $theme-properties: (
--link-color: #006DA0 #85B3EE,
--link-hover-color: #015378 #99c0f4,
--text-color: $black $text-dark-color,
--text-muted-color: #4B4B4B #697995,
--text-muted-color: #5c5c5c #697995,
--headings-color: $black #E3EEEF,
// Theme
@ -111,14 +111,17 @@ $theme-properties: (
--alert-warning-code-bg: #f3dfe1 #3d1014,
--alert-warning-link-decoration-color: #e3c3c6 #54141a,
// Doc Search
--docsearch-modal-background: #edf1f3 #1c232d,
--docsearch-container-background: rgba($black, 0.25) rgba(16, 21, 28, 0.851),
--ds-highlight-color: rgba(120, 133, 152, 0.125) rgba(16, 21, 28, 0.3),
--ds-search-bg: $white $dark-100,
--ds-search-placeholder-color: #7e7e7e #697995,
--ds-search-focus-shadow: rgba($white, 0.15) #1b232f,
--ds-scrollbar-bg: #bcc4cb #151b24,
// Search
--is-dropdown-bg: #edf1f3 #1c232d,
--is-container-background: rgba($black, 0.25) rgba(16, 21, 28, 0.851),
--is-highlight-color: rgba(120, 133, 152, 0.125) rgba(16, 21, 28, 0.3),
--is-search-focus-shadow: rgba($white, 0.15) #1b232f,
--is-hit-icon-color: $black $light-500,
--is-search-bg: $white $dark-100,
--is-search-icon: url(../img/icons/search-light.svg) url(../img/icons/search-dark.svg),
--is-refine-list-border-color: $light-400 $dark-300,
--is-hit-platform-border-color: #c5cad0 $dark-300,
--is-loader-circle-stroke: #c2c8d1 $dark-300,
);
// Activate dark/light themes

View File

@ -43,6 +43,7 @@ $text-dark-color: #A2ADC0;
$headings-dark-color: #E3EEEF;
// Font size
$font-size-xs: 0.75rem;
$font-size-sm: 0.8125rem;
$font-size-md: 0.9375rem;

View File

@ -6,7 +6,7 @@
<path d="M52.751.414h9.108v23.63h-9.108zM41.711.74l-18.488 9.92a.919.919 0 0 1-.856 0L3.879.74A2.808 2.808 0 0 0 2.558.414h-.023A2.4 2.4 0 0 0 0 2.641v21.376h9.1V13.842a.918.918 0 0 1 1.385-.682l10.361 5.568a3.634 3.634 0 0 0 3.336.028l10.933-5.634a.917.917 0 0 1 1.371.69v10.205h9.1V2.641A2.4 2.4 0 0 0 43.055.414h-.023a2.808 2.808 0 0 0-1.321.326zm65.564-.326h-9.237v10.755a.913.913 0 0 1-1.338.706L72.762.675a2.824 2.824 0 0 0-1.191-.261h-.016a2.4 2.4 0 0 0-2.535 2.227v21.377h9.163V13.275a.914.914 0 0 1 1.337-.707l24.032 11.2a2.813 2.813 0 0 0 1.188.26 2.4 2.4 0 0 0 2.535-2.227zm7.161 23.63V.414h4.191v23.63zm28.856.421c-11.274 0-19.272-4.7-19.272-12.232C124.02 4.741 132.066 0 143.292 0s19.32 4.7 19.32 12.233-7.902 12.232-19.32 12.232zm0-21.333c-8.383 0-14.84 3.217-14.84 9.1 0 5.926 6.457 9.1 14.84 9.1s14.887-3.174 14.887-9.1c0-5.883-6.504-9.1-14.887-9.1z" />
</svg>
</a>
<div class="header__title visible-rm">Documentation</div>
<div class="header__top__title visible-rm">Documentation</div>
<nav class="nav hidden-rm">
<a target="_blank" rel="noreferrer" href="https://subnet.min.io/" class="nav__link">
@ -45,10 +45,19 @@
{%- include "top-navigation.html" %}
<div class="header__hero hidden-rm">
<h2>Documentation</h2>
<div id="docsearch"></div>
<h2 class="header__title hidden-rm">Documentation</h2>
<div id="search">
<div class="search__inner">
<div id="search-box"></div>
<div class="search__dropdown">
<div id="search-filters"></div>
<div id="search-clear"></div>
<div id="search-results"></div>
<div id="search-powered-by"></div>
</div>
</div>
</div>
</div>

View File

@ -1,3 +1,3 @@
<svg width="14" height="15">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5 6.5a5 5 0 1 1-10 0 5 5 0 0 1 10 0Zm-1.59 5.535a6.5 6.5 0 1 1 1.179-.931l1.845 2.096a.75.75 0 0 1-1.127.99L9.91 12.036Z"/>
</svg>
</svg>

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 216 B

View File

@ -260,8 +260,10 @@ html_static_path = ['_static']
html_css_files = ['css/main.min.css', 'custom.css']
html_js_files = [
('https://cdn.jsdelivr.net/npm/@docsearch/js@3', {'defer': 'defer'}),
('https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js', {'defer': 'defer'}),
('https://cdn.jsdelivr.net/npm/instantsearch.js@4', {'defer': 'defer'}),
('js/main.js', {'defer': 'defer'}),
('js/instantSearch.js', {'defer': 'defer'}),
]
# Add https://www.min.io/robots.txt to html_extra_path list once available.