Skip to content

Commit

Permalink
feat(docs): Added doc search functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanp-fxl committed Nov 3, 2022
1 parent 208ba2d commit bc5a417
Show file tree
Hide file tree
Showing 46 changed files with 9,011 additions and 2,191 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TYPESENSE_API_KEY=xyz
4 changes: 4 additions & 0 deletions apps/docs/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TYPESENSE_API_KEY=xyz
TYPESENSE_HOST=host.docker.internal
TYPESENSE_PORT=443
TYPESENSE_PROTOCOL=https
37 changes: 37 additions & 0 deletions apps/docs/docsearch.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"index_name": "docusaurus-2",
"start_urls": ["https://docusaurus.io/"],
"sitemap_urls": ["https://docusaurus.io/sitemap.xml"],
"sitemap_alternate_links": true,
"stop_urls": ["/tests"],
"selectors": {
"lvl0": {
"selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]",
"type": "xpath",
"global": true,
"default_value": "Documentation"
},
"lvl1": "header h1",
"lvl2": "article h2",
"lvl3": "article h3",
"lvl4": "article h4",
"lvl5": "article h5, article td:first-child",
"lvl6": "article h6",
"text": "article p, article li, article td:last-child"
},
"strip_chars": " .,;:#",
"custom_settings": {
"separatorsToIndex": "_",
"attributesForFaceting": ["language", "version", "type", "docusaurus_tag"],
"attributesToRetrieve": [
"hierarchy",
"content",
"anchor",
"url",
"url_without_anchor",
"type"
]
},
"conversation_id": ["833762294"],
"nb_hits": 46250
}
30 changes: 27 additions & 3 deletions apps/docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const config = {
],
],

themes: ["docusaurus-theme-redoc", "docusaurus-theme-search-typesense"],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
Expand All @@ -70,6 +71,30 @@ const config = {
textColor: "#fff",
isCloseable: true,
},
tableOfContents: {
minHeadingLevel: 2,
maxHeadingLevel: 5,
},
typesense: {
typesenseCollectionName: "docusaurus-2", // Replace with your own doc site's name. Should match the collection name in the scraper settings.

typesenseServerConfig: {
nodes: [
{
host: "host.docker.internal",
port: 443,
protocol: "https",
},
],
apiKey: "xyz",
},

// Optional: Typesense search parameters: https://typesense.org/docs/0.21.0/api/search.md#search-parameters
typesenseSearchParameters: {},

// Optional
contextualSearch: true,
},
navbar: {
title: "Open System",
items: [
Expand Down Expand Up @@ -112,12 +137,12 @@ const config = {
title: "Documents",
items: [
{
label: "API End Points",
label: "OpenAPI Specs",
to: "docs/apis/introduction",
},
{
label: "Design System",
to: "Design System",
to: "design-system",
},
{
label: "Docs Style Guide",
Expand Down Expand Up @@ -148,7 +173,6 @@ const config = {
},
],
},

{
title: "Repository",
items: [
Expand Down
9 changes: 9 additions & 0 deletions apps/docs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
"options": {
"port": 3000
}
},
"semantic-release": {
"executor": "@theunderscorer/nx-semantic-release:semantic-release",
"options": {
"github": true,
"npm": false,
"changelog": true,
"tagFormat": "docs-v${VERSION}"
}
}
},
"tags": ["domain:docs", "type:apps"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DesignTokenTable from "./design-tokens-table.mdx";

# Design Tokens
# Design Tokens {#design-tokens}

<DesignTokenTable />

8 changes: 4 additions & 4 deletions apps/docs/src/components/DesignTokens/design-tokens-table.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ import { DisplayDesignToken } from "./DisplayDesignToken/DisplayDesignToken";
| :---------------: | :---: | :----------------------------------------------------------: |
| --os-spacing-lg | 45px | <DisplayDesignToken token="--os-spacing-lg" value="45px" /> |
| --os-spacing-md | 24px | <DisplayDesignToken token="--os-spacing-md" value="24px" /> |
| --os-spacing-sm | 12px | <DisplayDesignToken token="--os-spacing-sm" value="12px" /> |
| --os-spacing-xs | 8px | <DisplayDesignToken token="--os-spacing-xs" value="8px" /> |
| --os-spacing-xxs | 4px | <DisplayDesignToken token="--os-spacing-xxs" value="4px" /> |
| --os-spacing-xxxs | 2px | <DisplayDesignToken token="--os-spacing-xxxs" value="2px" /> |
| --os-spacing-sm | 18px | <DisplayDesignToken token="--os-spacing-sm" value="18px" /> |
| --os-spacing-xs | 12px | <DisplayDesignToken token="--os-spacing-xs" value="12px" /> |
| --os-spacing-xxs | 8px | <DisplayDesignToken token="--os-spacing-xxs" value="8px" /> |
| --os-spacing-xxxs | 4px | <DisplayDesignToken token="--os-spacing-xxxs" value="4px" /> |

## Padding

Expand Down
37 changes: 26 additions & 11 deletions apps/docs/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

--ifm-button-background-color: #501f98;

--ifm-navbar-height: 80px;

--ifm-footer-background-color: #e5e5e5;
--ifm-footer-title-color: var(--ifm-font-color-base);
--ifm-footer-link-color: var(--ifm-font-color-base);
Expand Down Expand Up @@ -134,16 +136,29 @@ html[data-theme="dark"] .text_white-glow {
text-shadow: 0 0 80px rgb(192 219 255 / 35%), 0 0 32px rgb(65 120 255 / 24%);
}

/*.footer {
background-color: var(--ifm-footer-background-color);
color: var(--ifm-footer-color);
padding: var(--ifm-footer-padding-vertical)
var(--ifm-footer-padding-horizontal);
.algolia-autocomplete .ds-dropdown-menu {
width: 500px;
}

.algolia-autocomplete .typesense-docsearch-suggestion--category-header {
color: darkgray;
border: 1px solid gray;
}

.algolia-autocomplete .typesense-docsearch-suggestion--subcategory-column {
color: gray;
}

.footer--dark {
--ifm-footer-background-color: #303846;
--ifm-footer-color: var(--ifm-footer-link-color);
--ifm-footer-link-color: var(--ifm-color-secondary);
--ifm-footer-title-color: var(--ifm-color-white);
}*/
.algolia-autocomplete .typesense-docsearch-suggestion--title {
font-weight: bold;
color: black;
}

.algolia-autocomplete .typesense-docsearch-suggestion--text {
font-size: 0.8rem;
color: gray;
}

.algolia-autocomplete .typesense-docsearch-suggestion--highlight {
color: blue;
}
8 changes: 0 additions & 8 deletions apps/docs/src/pages/design-system.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Link from "@docusaurus/Link";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import Layout from "@theme/Layout";
import clsx from "clsx";
Expand All @@ -16,13 +15,6 @@ export default function DesignSystem(): JSX.Element {
<div className="container">
<h1 className="hero__title title">Open System</h1>
<h2 className="text_white-glow subtitle">Design System</h2>
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
to="/docs/intro">
StoryBook 📘
</Link>
</div>
</div>
</header>
<main>
Expand Down
Binary file added apps/docs/typesense-data/db/000016.sst
Binary file not shown.
Binary file added apps/docs/typesense-data/db/000017.log
Binary file not shown.
Binary file added apps/docs/typesense-data/db/000018.sst
Binary file not shown.
1 change: 1 addition & 0 deletions apps/docs/typesense-data/db/CURRENT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MANIFEST-000004
1 change: 1 addition & 0 deletions apps/docs/typesense-data/db/IDENTITY
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6b371799-ff95-487d-a432-7862a6891a07
Empty file.
Loading

0 comments on commit bc5a417

Please sign in to comment.