Skip to content

Commit 800ee59

Browse files
feat: more search domains
1 parent a5009df commit 800ee59

File tree

5 files changed

+45
-7
lines changed

5 files changed

+45
-7
lines changed

lake-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"subDir": null,
1717
"scope": "",
18-
"rev": "b1484a6fe948b6a407e3d6f30b9aa073877b6954",
18+
"rev": "9dbac26d254a8b4f6ea935cb0d4f79608f2cd274",
1919
"name": "verso",
2020
"manifestFile": "lake-manifest.json",
2121
"inputRev": "custom-head",

static/search/domain-mappers.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const docOptionDomainMapper = {
3838
const docTacticDomainMapper = {
3939
dataToSearchables: (domainData) =>
4040
Object.entries(domainData.contents).map(([key, value]) => ({
41-
searchKey: key,
41+
searchKey: value[0].data.userName,
4242
address: `${value[0].address}#${value[0].id}`,
4343
domainId: "Verso.Genre.Manual.doc.tactic",
4444
ref: value,
@@ -47,6 +47,21 @@ const docTacticDomainMapper = {
4747
displayName: "Tactic",
4848
};
4949

50+
/**
51+
* @type {DomainMapper}
52+
*/
53+
const docConvTacticDomainMapper = {
54+
dataToSearchables: (domainData) =>
55+
Object.entries(domainData.contents).map(([key, value]) => ({
56+
searchKey: value[0].data.userName,
57+
address: `${value[0].address}#${value[0].id}`,
58+
domainId: "Verso.Genre.Manual.doc.tactic.conv",
59+
ref: value,
60+
})),
61+
className: "doc-tactic-domain",
62+
displayName: "Conv Tactic",
63+
};
64+
5065
/**
5166
* @type {DomainMapper}
5267
*/
@@ -62,9 +77,26 @@ const sectionMapper = {
6277
displayName: "Section",
6378
};
6479

80+
/**
81+
* @type {DomainMapper}
82+
*/
83+
const techTermMapper = {
84+
dataToSearchables: (domainData) =>
85+
Object.entries(domainData.contents).map(([key, value]) => ({
86+
searchKey: value[0].data.term,
87+
address: `${value[0].address}#${value[0].id}`,
88+
domainId: "Verso.Genre.Manual.doc.tech",
89+
ref: value,
90+
})),
91+
className: "tech-term-domain",
92+
displayName: "Terminology",
93+
};
94+
6595
export const domainMappers = {
6696
"Verso.Genre.Manual.doc": docDomainMapper,
6797
"Verso.Genre.Manual.doc.option": docOptionDomainMapper,
6898
"Verso.Genre.Manual.doc.tactic": docTacticDomainMapper,
99+
"Verso.Genre.Manual.doc.tactic.conv": docConvTacticDomainMapper,
69100
"Verso.Genre.Manual.section": sectionMapper,
101+
"Verso.Genre.Manual.doc.tech": techTermMapper,
70102
};

static/search/search-box.css

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
}
3030

3131
#search-wrapper .combobox input {
32-
width: 16rem;
32+
width: 24rem;
3333
outline: none;
3434
font-size: .9rem;
3535
padding: .3rem .5rem;
@@ -46,7 +46,7 @@
4646
padding: 0;
4747
position: absolute;
4848
top: calc(100%);
49-
width: 16rem;
49+
width: 24rem;
5050
list-style: none;
5151
background-color: white;
5252
display: none;
@@ -76,6 +76,10 @@
7676
font-family: var(--verso-code-font-family);
7777
}
7878

79+
#search-wrapper .search-result.tech-term-domain {
80+
font-family: var(--verso-text-font-family);
81+
}
82+
7983
#search-wrapper .search-result.section-domain {
8084
font-family: var(--verso-structure-font-family);
8185
font-weight: bold;
@@ -124,5 +128,7 @@
124128
#search-wrapper {
125129
padding: var(--verso--content-padding-x);
126130
width: fit-content;
127-
float: right;
131+
position: absolute;
132+
top: 0;
133+
right: 0;
128134
}

static/search/search-box.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const dataToSearchableMap = (json, domainMappers) =>
3939
return acc;
4040
}
4141

42-
if (!acc[cur.searchKey]) {
42+
if (!acc.hasOwnProperty(cur.searchKey)) {
4343
acc[cur.searchKey] = [];
4444
}
4545
acc[cur.searchKey].push(cur);

static/search/search-init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const searchHTML = `<div id="search-wrapper">
1212
class="cb_edit"
1313
type="search"
1414
role="searchbox"
15-
placeholder="Search"
15+
placeholder="Index"
1616
aria-autocomplete="list"
1717
aria-expanded="false"
1818
aria-controls="cb1-listbox"

0 commit comments

Comments
 (0)