Skip to content

Commit c7a5d80

Browse files
committed
Merge branch 'algolia'
2 parents ee4793e + 7f0a78e commit c7a5d80

File tree

11 files changed

+832
-2
lines changed

11 files changed

+832
-2
lines changed

assets/js/docsearch.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import docsearch from "@docsearch/js";
2+
3+
docsearch({
4+
appId: "ER865HD7LN",
5+
apiKey: "56b4cffcb36dc6b444754b5cdf907917",
6+
container: "#docsearch",
7+
debug: false,
8+
indexName: "help-yagpdb",
9+
insights: true
10+
});
11+
12+
const onClick = function () {
13+
document.getElementsByClassName("DocSearch-Button")[0].click();
14+
};
15+
16+
document.getElementById("searchToggleMobile").onclick = onClick;
17+
document.getElementById("searchToggleDesktop").onclick = onClick;

assets/scss/app.scss

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// Source: https://getbootstrap.com/docs/5.3/customize/sass/#importing
2+
3+
// 1. Include functions first (so you can manipulate colors, SVGs, calc, etc)
4+
@import "bootstrap/scss/functions";
5+
6+
// 2. Include any default variable overrides here
7+
@import "common/colors";
8+
@import "common/variables-overrides";
9+
@import "common/variables-custom";
10+
11+
// 3. Include remainder of required Bootstrap stylesheets (including any separate color mode stylesheets)
12+
@import "bootstrap/scss/variables";
13+
@import "bootstrap/scss/variables-dark";
14+
15+
// 4. Include any default map overrides here
16+
17+
// 5. Include remainder of required parts
18+
@import "bootstrap/scss/maps";
19+
@import "bootstrap/scss/mixins";
20+
@import "bootstrap/scss/root";
21+
22+
// 6. Optionally include any other parts as needed
23+
24+
// Layout & components
25+
@import "bootstrap/scss/utilities";
26+
@import "bootstrap/scss/reboot";
27+
@import "bootstrap/scss/type";
28+
@import "bootstrap/scss/images";
29+
@import "bootstrap/scss/containers";
30+
@import "bootstrap/scss/grid";
31+
@import "bootstrap/scss/helpers";
32+
@import "bootstrap/scss/tables";
33+
@import "bootstrap/scss/forms";
34+
@import "bootstrap/scss/buttons";
35+
@import "bootstrap/scss/transitions";
36+
@import "bootstrap/scss/dropdown";
37+
@import "bootstrap/scss/button-group";
38+
@import "bootstrap/scss/nav";
39+
@import "bootstrap/scss/navbar";
40+
@import "bootstrap/scss/card";
41+
@import "bootstrap/scss/accordion";
42+
@import "bootstrap/scss/breadcrumb";
43+
@import "bootstrap/scss/pagination";
44+
@import "bootstrap/scss/badge";
45+
@import "bootstrap/scss/alert";
46+
@import "bootstrap/scss/progress";
47+
@import "bootstrap/scss/list-group";
48+
@import "bootstrap/scss/close";
49+
@import "bootstrap/scss/toasts";
50+
@import "bootstrap/scss/modal";
51+
@import "bootstrap/scss/tooltip";
52+
@import "bootstrap/scss/popover";
53+
@import "bootstrap/scss/carousel";
54+
@import "bootstrap/scss/spinners";
55+
@import "bootstrap/scss/offcanvas";
56+
@import "bootstrap/scss/placeholders";
57+
58+
// 7. Optionally include utilities API last to generate classes based on the Sass map in `_utilities.scss`
59+
@import "bootstrap/scss/utilities/api";
60+
61+
// 8. Add additional custom code here
62+
@import "common/fonts";
63+
@import "common/global";
64+
@import "common/syntax";
65+
@import "common/dark";
66+
@import "components/alerts";
67+
@import "components/buttons";
68+
@import "components/callouts";
69+
@import "components/expressive-code";
70+
@import "components/code";
71+
@import "components/comments";
72+
@import "components/details";
73+
@import "components/forms";
74+
@import "components/images";
75+
@import "components/mermaid";
76+
@import "components/modals";
77+
@import "components/search";
78+
@import "components/section-nav";
79+
@import "components/tables";
80+
@import "components/tabs";
81+
@import "layouts/footer";
82+
@import "layouts/header";
83+
@import "layouts/pages";
84+
@import "layouts/posts";
85+
@import "layouts/sidebar";
86+
87+
/*
88+
body {
89+
background-color: {{ site.Params.doks.backGround }};
90+
}
91+
*/
92+
93+
// 9. Custom styles
94+
@import "common/custom";
95+
96+
// 10. DocSearch
97+
@import "common/variables-docsearch";
98+
@import "@docsearch/css/dist/modal";

assets/scss/common/_custom.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,24 @@ pre.shiki {
158158
opacity: 0.75;
159159
}
160160
}
161+
162+
// DocSearch
163+
164+
.DocSearch-Container {
165+
z-index: 2000 !important;
166+
}
167+
168+
.DocSearch-Hit-icon {
169+
display: flex;
170+
align-items: center;
171+
}
172+
173+
.DocSearch-Hits mark {
174+
padding: 0;
175+
}
176+
177+
@media (max-width: 768px) {
178+
.DocSearch-Modal {
179+
position: fixed !important;
180+
}
181+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/* Darkmode */
2+
3+
:root {
4+
--docsearch-primary-color: var(--sl-color-text-accent);
5+
--docsearch-text-color: var(--sl-color-text);
6+
--docsearch-spacing: 12px;
7+
--docsearch-icon-stroke-width: 1.4;
8+
--docsearch-highlight-color: var(--docsearch-primary-color);
9+
--docsearch-muted-color: var(--sl-color-gray-3);
10+
--docsearch-container-background: var(--sl-color-backdrop-overlay);
11+
12+
/* modal */
13+
--docsearch-modal-width: 560px;
14+
--docsearch-modal-height: 600px;
15+
--docsearch-modal-background: var(--sl-color-gray-6);
16+
--docsearch-modal-shadow: var(--sl-shadow-lg);
17+
18+
/* searchbox */
19+
--docsearch-searchbox-height: 56px;
20+
--docsearch-searchbox-background: var(--sl-color-gray-7, var(--sl-color-gray-6));
21+
--docsearch-searchbox-focus-background: var(--sl-color-black);
22+
--docsearch-searchbox-shadow: inset 0 0 0 1px var(--docsearch-primary-color);
23+
24+
/* hit */
25+
--docsearch-hit-height: 56px;
26+
--docsearch-hit-color: var(--sl-color-white);
27+
--docsearch-hit-active-color: var(--sl-color-black);
28+
--docsearch-hit-background: var(--sl-color-black);
29+
30+
/* key */
31+
--docsearch-key-gradient: linear-gradient(var(--sl-color-bg-inline-code) 0%, var(--sl-color-bg-inline-code) 100%);
32+
33+
/* footer */
34+
--docsearch-footer-height: 44px;
35+
--docsearch-footer-background: var(--sl-color-black);
36+
--docsearch-footer-shadow: 0 -1px 0 0 var(--sl-color-hairline-light);
37+
}
38+
39+
html[data-bs-theme="light"] {
40+
// --docsearch-primary-color: rgb(84, 104, 255);
41+
--docsearch-primary-color: #5d2f86;
42+
--docsearch-text-color: rgb(28, 30, 33);
43+
--docsearch-spacing: 12px;
44+
--docsearch-icon-stroke-width: 1.4;
45+
--docsearch-highlight-color: var(--docsearch-primary-color);
46+
--docsearch-muted-color: rgb(150, 159, 175);
47+
--docsearch-container-background: rgba(101, 108, 133, 0.8);
48+
--docsearch-logo-color: rgba(84, 104, 255);
49+
50+
/* modal */
51+
--docsearch-modal-width: 560px;
52+
--docsearch-modal-height: 600px;
53+
--docsearch-modal-background: rgb(245, 246, 247);
54+
--docsearch-modal-shadow: inset 1px 1px 0 0 rgba(255, 255, 255, 0.5), 0 3px 8px 0 rgba(85, 90, 100, 1);
55+
56+
/* searchbox */
57+
--docsearch-searchbox-height: 56px;
58+
--docsearch-searchbox-background: rgb(235, 237, 240);
59+
--docsearch-searchbox-focus-background: #fff;
60+
--docsearch-searchbox-shadow: inset 0 0 0 2px var(--docsearch-primary-color);
61+
62+
/* hit */
63+
--docsearch-hit-height: 56px;
64+
--docsearch-hit-color: rgb(68, 73, 80);
65+
--docsearch-hit-active-color: #fff;
66+
--docsearch-hit-background: #fff;
67+
68+
// --docsearch-hit-shadow: 0 1px 3px 0 rgb(212, 217, 225);
69+
70+
/* key */
71+
--docsearch-key-gradient: linear-gradient(#edeff3 0%, #edeff3 100%);
72+
73+
/*
74+
--docsearch-key-shadow: inset 0 -2px 0 0 rgb(205, 205, 230),
75+
inset 0 0 1px 1px #fff, 0 1px 2px 1px rgba(30, 35, 90, 0.4);
76+
--docsearch-key-pressed-shadow: inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 1px 0 rgba(30,35,90,0.4);
77+
*/
78+
79+
/* footer */
80+
--docsearch-footer-height: 44px;
81+
--docsearch-footer-background: #fff;
82+
83+
/*
84+
--docsearch-footer-shadow: 0 -1px 0 0 rgb(224, 227, 232),
85+
0 -3px 6px 0 rgba(69, 98, 155, 0.12);
86+
*/
87+
--docsearch-footer-shadow: 0 -1px 0 0 var(--sl-color-hairline-dark);
88+
}
89+
90+
/* Custom style overrides */
91+
.DocSearch-Modal {
92+
border: 1px solid var(--sl-color-hairline-light);
93+
}
94+
95+
.DocSearch-Logo svg * {
96+
fill: var(--docsearch-muted-color);
97+
}

config/_default/params.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ images = [] # og:image; not needed.
44

55
mainSections = ["docs"]
66

7+
[add_ons]
8+
docSearch = true
9+
710
# Doks (@hyas/doks-core)
811
[doks]
912
# Color mode
@@ -20,7 +23,7 @@ mainSections = ["docs"]
2023
navBarButtonText = "Get started"
2124

2225
# FlexSearch
23-
flexSearch = true # true (default) or false
26+
flexSearch = false # true (default) or false
2427
searchExclKinds = [] # list of page kinds to exclude from search indexing (e.g. ["home", "taxonomy", "term"] )
2528
searchExclTypes = [] # list of content types to exclude from search indexing (e.g. ["blog", "docs", "legal", "contributors", "categories"])
2629
showSearch = [] # [] (all pages, default) or homepage (optionally) and list of sections (e.g. ["homepage", "blog", "guides"])

config/postcss.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = {
1818
],
1919
dynamicAttributes: [
2020
'aria-expanded',
21+
'aria-selected',
2122
'data-bs-popper',
2223
'data-bs-target',
2324
'data-bs-theme',
@@ -58,9 +59,10 @@ module.exports = {
5859
'page-link',
5960
...whitelister([
6061
'./assets/scss/**/*.scss',
62+
'./node_modules/@docsearch/css/dist/modal.css',
63+
'./node_modules/@hyas/doks-core/assets/scss/common/_syntax.scss',
6164
'./node_modules/@hyas/doks-core/assets/scss/components/_code.scss',
6265
'./node_modules/@hyas/doks-core/assets/scss/components/_expressive-code.scss',
63-
'./node_modules/@hyas/doks-core/assets/scss/common/_syntax.scss',
6466
]),
6567
],
6668
}),

layouts/partials/footer/script-footer-custom.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@
1111
{{ partial "footer/esbuild" (dict "src" "js/gallery.js" "load" "async" "transpile" false) -}}
1212
{{ end -}}
1313
*/}}
14+
15+
{{/* Algolia DocSearch */}}
16+
{{ if site.Params.add_ons.docSearch -}}
17+
{{ partial "footer/esbuild" (dict "src" "js/docsearch.js" "load" "async" "transpile" false) -}}
18+
{{ end -}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
<!-- Custom head -->
2+
3+
<!-- hint UAs that we will fetch from Algolia, thereby improving query speed-->
4+
<link rel="preconnect" href="https://YOUR_APP_ID-dsn.algolia.net" crossorigin />

0 commit comments

Comments
 (0)