Skip to content
Open
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
15 changes: 9 additions & 6 deletions ark/docs/components/InstallationTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import { Tab, Tabs } from "fumadocs-ui/components/tabs"
import { CodeBlock } from "./CodeBlock.tsx"

const installers = ["pnpm", "npm", "yarn", "bun"] as const satisfies string[]

export type Installer = (typeof installers)[number]
const installerCommands = {
pnpm: "install",
npm: "install",
yarn: "add",
bun: "add"
} as const satisfies Record<string, string>

type InstallationTabProps = {
name: Installer
name: keyof typeof installerCommands
}

const InstallerTab = ({ name }: InstallationTabProps) => (
<Tab value={name} className="installer-tab">
<CodeBlock lang="bash">{`${name} ${name === "yarn" ? "add" : "install"} arktype`}</CodeBlock>
<CodeBlock lang="bash">{`${name} ${installerCommands[name]} arktype`}</CodeBlock>
</Tab>
)

export const InstallationTabs = () => (
<Tabs items={installers}>
<Tabs items={Object.keys(installerCommands)}>
<InstallerTab name="pnpm" />
<InstallerTab name="npm" />
<InstallerTab name="yarn" />
Expand Down
Loading