Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions site/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"dependencies": {
"@orama/orama": "^3.1.18",
"@thepowderworks/fumadocs": "github:PowderworksCode/docs",
"cnfast": "^0.0.8",
"fumadocs-core": "16.11.1",
"fumadocs-mdx": "15.1.0",
Expand All @@ -35,5 +36,8 @@
"tailwindcss": "^4.3.1",
"typescript": "^6.0.3",
"wrangler": "^4.123.0"
}
},
"trustedDependencies": [
"@thepowderworks/fumadocs"
]
}
15 changes: 15 additions & 0 deletions site/src/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
@import "fumadocs-ui/css/neutral.css";
@import "fumadocs-ui/css/preset.css";

/* The shared package's nav markup uses these class names; keep them styled
* here in this site's own visual language instead of importing the fleet
* theme's paper-and-flame palette. */
.pw-nav-title {
display: inline-flex;
align-items: center;
gap: 0.5rem;
}

.pw-nav-mark {
width: 1.375rem;
height: 1.375rem;
border-radius: 0.125rem;
}

html {
scrollbar-gutter: stable;
}
Expand Down
12 changes: 6 additions & 6 deletions site/src/components/mdx.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import defaultMdxComponents from "fumadocs-ui/mdx";
import type { MDXComponents } from "mdx/types";
import {
getPowderworksMDXComponents,
useMDXComponents as usePowderworksMDXComponents,
} from "@thepowderworks/fumadocs/mdx";

export function getMDXComponents(components?: MDXComponents) {
return {
...defaultMdxComponents,
...components,
} satisfies MDXComponents;
return getPowderworksMDXComponents(components);
}

export const useMDXComponents = getMDXComponents;
export const useMDXComponents = usePowderworksMDXComponents;

declare global {
type MDXProvidedComponents = ReturnType<typeof getMDXComponents>;
Expand Down
10 changes: 7 additions & 3 deletions site/src/components/provider.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
"use client";
import { RootProvider } from "fumadocs-ui/provider/next";

import { PowderworksProvider } from "@thepowderworks/fumadocs/provider";
import type { ReactNode } from "react";
import SearchDialog from "@/components/search";
import { translations } from "@/lib/i18n";

export function Provider({ children }: { children: ReactNode }) {
return (
<RootProvider
<PowderworksProvider
lang="en"
translations={translations}
search={{ SearchDialog }}
theme={{ defaultTheme: "dark", enableSystem: false }}
>
{children}
</RootProvider>
</PowderworksProvider>
);
}
56 changes: 6 additions & 50 deletions site/src/components/search.tsx
Original file line number Diff line number Diff line change
@@ -1,54 +1,10 @@
// Search dialog over the static Orama index. Supported languages:
// https://docs.orama.com/docs/orama-js/supported-languages
"use client";
import { create } from "@orama/orama";
import { useDocsSearch } from "fumadocs-core/search/client";
import { oramaStaticClient } from "fumadocs-core/search/client/orama-static";
import {
SearchDialog,
SearchDialogClose,
SearchDialogContent,
SearchDialogHeader,
SearchDialogIcon,
SearchDialogInput,
SearchDialogList,
SearchDialogOverlay,
type SharedProps,
} from "fumadocs-ui/components/dialog/search";
import { useI18n } from "fumadocs-ui/contexts/i18n";

function initOrama() {
return create({
schema: { _: "string" },
language: "english",
});
}

export default function DefaultSearchDialog(props: SharedProps) {
const { locale } = useI18n();
const { search, setSearch, query } = useDocsSearch({
client: oramaStaticClient({
initOrama,
locale,
}),
});
import {
PowderworksSearchDialog,
type PowderworksSearchProps,
} from "@thepowderworks/fumadocs/search";

return (
<SearchDialog
search={search}
onSearchChange={setSearch}
isLoading={query.isLoading}
{...props}
>
<SearchDialogOverlay />
<SearchDialogContent>
<SearchDialogHeader>
<SearchDialogIcon />
<SearchDialogInput />
<SearchDialogClose />
</SearchDialogHeader>
<SearchDialogList items={query.data !== "empty" ? query.data : null} />
</SearchDialogContent>
</SearchDialog>
);
export default function SearchDialog(props: PowderworksSearchProps) {
return <PowderworksSearchDialog {...props} />;
}
7 changes: 7 additions & 0 deletions site/src/lib/i18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { definePowderworksI18n } from "@thepowderworks/fumadocs/i18n";
import { site } from "./site";

export const { translations } = definePowderworksI18n(
site.locales,
site.defaultLocale,
);
20 changes: 3 additions & 17 deletions site/src/lib/layout.shared.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
import { createPowderworksBaseOptions } from "@thepowderworks/fumadocs/layout";
import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
import { appName, gitConfig } from "./shared";
import { site } from "./site";

export function baseOptions(
links: BaseLayoutProps["links"] = [],
): BaseLayoutProps {
return {
nav: {
title: (
<span className="inline-flex items-center gap-2">
<img
src="/strait-face.png"
alt=""
aria-hidden
width={22}
height={22}
className="rounded-sm"
/>
{appName}
</span>
),
},
...createPowderworksBaseOptions(site, site.defaultLocale),
links,
githubUrl: `https://github.com/${gitConfig.user}/${gitConfig.repo}`,
};
}
11 changes: 11 additions & 0 deletions site/src/lib/site.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { definePowderworksSite } from "@thepowderworks/fumadocs/config";

export const site = definePowderworksSite({
name: "Straitjacket",
description: "A secret scanner, but for slop.",
repository: "PowderworksCode/straitjacket",
siteUrl: "https://straitjacket.dev",
mark: { src: "/strait-face.png", alt: "Straitjacket" },
locales: [{ code: "en", name: "English", searchLanguage: "english" }],
defaultLocale: "en",
});