Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 18ea3d0

Browse files
authored
feat(docs): implemented DocSearch (#2525)
1 parent 5a5a45f commit 18ea3d0

File tree

7 files changed

+724
-712
lines changed

7 files changed

+724
-712
lines changed

package-lock.json

Lines changed: 683 additions & 708 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"@changesets/cli": "^2.27.11",
7676
"@commitlint/cli": "^19.6.1",
7777
"@commitlint/config-conventional": "^19.6.0",
78+
"@docsearch/js": "^3.8.2",
7879
"@ebay/browserslist-config": "^2.10.0",
7980
"@floating-ui/dom": "^1.6.13",
8081
"@marko/run": "^0.5.13",
@@ -126,13 +127,13 @@
126127
"ncp": "^2",
127128
"npm-run-all": "^4",
128129
"postcss": "^8.4.49",
129-
"postcss-mixins": "^10.0.1",
130-
"postcss-nested": "^6.2.0",
131-
"postcss-simple-vars": "^7.0.1",
132130
"postcss-cli": "^11.0.0",
133131
"postcss-comment": "^2.0.0",
134132
"postcss-import": "^16.1.0",
135133
"postcss-loader": "^8.1.1",
134+
"postcss-mixins": "^10.0.1",
135+
"postcss-nested": "^6.2.0",
136+
"postcss-simple-vars": "^7.0.1",
136137
"prettier": "^3.4.2",
137138
"prismjs": "^1.29.0",
138139
"rimraf": "^6",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default class {
2+
async onMount() {
3+
const { init } = await import("./doc-search");
4+
init(this.getEl("container"));
5+
}
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import "@docsearch/css";
2+
import docsearch from "@docsearch/js";
3+
4+
export function init(container) {
5+
docsearch({
6+
container,
7+
indexName: "skin",
8+
appId: "4AG9MNELVM",
9+
apiKey: "9b7a33ff8f0985b0f2b66e90c020b459",
10+
});
11+
}

src/components/search/index.marko

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<link rel="preconnect" href="https://R2IYF7ETH7-dsn.algolia.net" crossorigin />
2+
<div.search key="container"/>
3+
4+
style {
5+
.DocSearch-SearchBar {
6+
--docsearch-highlight-color: var(--color-foreground-on-inverse);
7+
}
8+
9+
header.DocSearch-SearchBar {
10+
min-height: 76px;
11+
}
12+
13+
.DocSearch-LoadingIndicator svg,
14+
.DocSearch-MagnifierLabel svg {
15+
color: var(--color-foreground-accent);
16+
}
17+
}

src/components/site-header.marko

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {components} from './components.marko';
2727
<li><a role="menuitem" href="/storybook">Storybook</a></li>
2828
</ul>
2929
</nav>
30+
<search/>
3031
</div>
3132
</div>
3233
</div>

src/components/site-header.style.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ svg.icon.mobile-menu__close {
183183
}
184184

185185
.top-bar {
186-
grid-template-columns: auto auto auto;
186+
display: flex;
187+
justify-content: space-between;
187188
}
188189

189190
.app-bar__title {

0 commit comments

Comments
 (0)