Skip to content

Commit

Permalink
feat(docs): implemented DocSearch (#2525)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtBlue authored Jan 21, 2025
1 parent 5a5a45f commit 18ea3d0
Show file tree
Hide file tree
Showing 7 changed files with 724 additions and 712 deletions.
1,391 changes: 683 additions & 708 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"@changesets/cli": "^2.27.11",
"@commitlint/cli": "^19.6.1",
"@commitlint/config-conventional": "^19.6.0",
"@docsearch/js": "^3.8.2",
"@ebay/browserslist-config": "^2.10.0",
"@floating-ui/dom": "^1.6.13",
"@marko/run": "^0.5.13",
Expand Down Expand Up @@ -126,13 +127,13 @@
"ncp": "^2",
"npm-run-all": "^4",
"postcss": "^8.4.49",
"postcss-mixins": "^10.0.1",
"postcss-nested": "^6.2.0",
"postcss-simple-vars": "^7.0.1",
"postcss-cli": "^11.0.0",
"postcss-comment": "^2.0.0",
"postcss-import": "^16.1.0",
"postcss-loader": "^8.1.1",
"postcss-mixins": "^10.0.1",
"postcss-nested": "^6.2.0",
"postcss-simple-vars": "^7.0.1",
"prettier": "^3.4.2",
"prismjs": "^1.29.0",
"rimraf": "^6",
Expand Down
6 changes: 6 additions & 0 deletions src/components/search/component-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default class {
async onMount() {
const { init } = await import("./doc-search");
init(this.getEl("container"));
}
}
11 changes: 11 additions & 0 deletions src/components/search/doc-search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "@docsearch/css";
import docsearch from "@docsearch/js";

export function init(container) {
docsearch({
container,
indexName: "skin",
appId: "4AG9MNELVM",
apiKey: "9b7a33ff8f0985b0f2b66e90c020b459",
});
}
17 changes: 17 additions & 0 deletions src/components/search/index.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<link rel="preconnect" href="https://R2IYF7ETH7-dsn.algolia.net" crossorigin />
<div.search key="container"/>

style {
.DocSearch-SearchBar {
--docsearch-highlight-color: var(--color-foreground-on-inverse);
}
header.DocSearch-SearchBar {
min-height: 76px;
}
.DocSearch-LoadingIndicator svg,
.DocSearch-MagnifierLabel svg {
color: var(--color-foreground-accent);
}
}
1 change: 1 addition & 0 deletions src/components/site-header.marko
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {components} from './components.marko';
<li><a role="menuitem" href="/storybook">Storybook</a></li>
</ul>
</nav>
<search/>
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/site-header.style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ svg.icon.mobile-menu__close {
}

.top-bar {
grid-template-columns: auto auto auto;
display: flex;
justify-content: space-between;
}

.app-bar__title {
Expand Down

0 comments on commit 18ea3d0

Please sign in to comment.