@luciodale/docs-ui-kit 0.3.35 → 0.3.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -176,6 +176,10 @@
|
|
|
176
176
|
return flat.slice(0, 10);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
function ensureAbsolute(url: string): string {
|
|
180
|
+
return url.startsWith("/") ? url : `/${url}`;
|
|
181
|
+
}
|
|
182
|
+
|
|
179
183
|
function renderResults(items: PagefindResult[], query: string) {
|
|
180
184
|
const container = document.getElementById("search-results");
|
|
181
185
|
if (!container) return;
|
|
@@ -197,7 +201,7 @@
|
|
|
197
201
|
container.innerHTML = flat
|
|
198
202
|
.map(
|
|
199
203
|
(r) => `
|
|
200
|
-
<a href="${r.url}" style="display: block; border-radius: 0.5rem; padding: 0.625rem 0.75rem; transition: background-color 150ms; text-decoration: none;" onmouseenter="this.style.background='rgb(255 255 255 / 0.04)'" onmouseleave="this.style.background='transparent'" data-search-result>
|
|
204
|
+
<a href="${ensureAbsolute(r.url)}" style="display: block; border-radius: 0.5rem; padding: 0.625rem 0.75rem; transition: background-color 150ms; text-decoration: none;" onmouseenter="this.style.background='rgb(255 255 255 / 0.04)'" onmouseleave="this.style.background='transparent'" data-search-result>
|
|
201
205
|
<div style="display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.125rem;">
|
|
202
206
|
<span style="font-size: 0.875rem; font-weight: 500; color: rgb(255 255 255 / 0.8);">${r.title}</span>
|
|
203
207
|
${r.section ? `<span style="font-size: 11px; color: rgb(255 255 255 / 0.35);">${r.section}</span>` : ""}
|