Skip to content

Commit

Permalink
Docs: Initial navigation sidebar.
Browse files Browse the repository at this point in the history
  • Loading branch information
filiphsps committed Sep 24, 2024
1 parent 3b006f0 commit b3e3bd6
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 8 deletions.
4 changes: 1 addition & 3 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ let config = {
experimental: {
appNavFailHandling: true,
caseSensitiveRoutes: true,
mdxRs: {
mdxType: 'gfm'
},
mdxRs: true,
optimizePackageImports: [],
optimizeServerReact: true,
parallelServerBuildTraces: true,
Expand Down
53 changes: 51 additions & 2 deletions docs/src/app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import '@/styles/base.scss';
import * as Nordstar from '@nordcom/nordstar';
import { Label } from '@nordcom/nordstar';

import type { Metadata } from 'next';
import Link from 'next/link';
import type { ReactNode } from 'react';

export const metadata: Metadata = {
Expand All @@ -11,6 +13,53 @@ export const metadata: Metadata = {
}
};

function NavBlock({ label, href, children }: { label: string; href: string; children: ReactNode }) {
return (
<section className="flex flex-col gap-4">
<Label as={Link} href={href} className="block text-base leading-none text-foreground">
{label}
</Label>

<div className="flex flex-col gap-4 px-3 text-base font-normal leading-none text-foreground-highlight *:flex *:gap-3 *:text-inherit *:leading-none *:transition-colors *:before:block *:before:content-['•']">
{children}
</div>
</section>
);
}

export default function DocsLayout({ children }: { children: ReactNode }) {
return <>{children}</>;
return (
<div className="grid grid-cols-[18rem_1fr] gap-6">
<nav className="flex flex-col gap-6">
<NavBlock label="Guide" href="/docs/">
<Link href="/docs/getting-started/" className="hover:text-primary">
Introduction
</Link>
<Link href="/docs/installation/" className="hover:text-primary">
Installation
</Link>
</NavBlock>

<NavBlock label="Customization" href="/docs/customization/">
<Link href="/docs/customization/theme/" className="hover:text-primary">
Theme
</Link>
<Link href="/docs/customization/system/" className="hover:text-primary">
System
</Link>
</NavBlock>

<NavBlock label="Components" href="/docs/components/">
{Object.keys(Nordstar)
.filter((key) => (Nordstar as any)[key].displayName)
.map((key) => (
<Link key={key} href={`/docs/components/${key}/`} className="hover:text-primary">
{key}
</Link>
))}
</NavBlock>
</nav>
<section>{children}</section>
</div>
);
}
2 changes: 1 addition & 1 deletion docs/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@/styles/base.scss';
import '@/styles/globals.css';

import { Providers } from '@/components/providers';
import { Card, cn, Header, View } from '@nordcom/nordstar';
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/core/system/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [@nordcom/nordstar-system](https://nordstar.dev/docs/system/?utm_source=nordstar&utm_campaign=oss)
# [@nordcom/nordstar-system](https://nordstar.dev/docs/customization/system/?utm_source=nordstar&utm_campaign=oss)

General utility libraries and tools used by all of the Nordstar components, hooks and packages. Also currently provides the theming for all components, which should be extracted to another package.

Expand Down
2 changes: 1 addition & 1 deletion packages/core/system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"bugs": {
"url": "https://github.com/NordcomInc/nordstar/issues"
},
"homepage": "https://nordstar.dev/docs/system/",
"homepage": "https://nordstar.dev/docs/customization/system/",
"scripts": {
"build": "vite build",
"dev": "vite build --watch",
Expand Down

0 comments on commit b3e3bd6

Please sign in to comment.