Skip to content

Commit

Permalink
Merge pull request #246 from vordgi/rd-245
Browse files Browse the repository at this point in the history
rd-245 add package links
  • Loading branch information
vordgi authored Oct 1, 2024
2 parents a070fe5 + 4d92679 commit 12122a5
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Introduction
description: Robindoc is a framework for automatically creating documentation websites based on markdown files, built on React.js Server Components
---
[robin.title]: # "Introduction"
[robin.description]: # "Robindoc is a framework for automatically creating documentation websites based on markdown files, built on React.js Server Components"

# Robindoc

Expand All @@ -11,6 +9,8 @@ Read the documentation in a convenient interface at [robindoc.com/docs](https://

<!---/robin-->

<!---robin PackageLinks /-->

Robindoc is a framework for automatically creating documentation websites based on markdown files, built on React.js Server Components.

```tsx
Expand Down
2 changes: 1 addition & 1 deletion packages/robindoc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "robindoc",
"version": "1.0.0",
"version": "1.0.1",
"description": "",
"main": "./lib/index.js",
"scripts": {
Expand Down
9 changes: 6 additions & 3 deletions site/src/app/docs/[[...path]]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Note } from "../../../components/ui/note";
import { Page, Sidebar, getMeta, getPages, getPageData } from "./robindoc";
import { KeylinkToNavigation } from "robindoc";
import Link from "next/link";
import { KeylinkToNavigation } from "robindoc";

import { Page, Sidebar, getMeta, getPages, getPageData } from "./robindoc";
import { Note } from "../../../components/ui/note";
import { PackageLinks } from "../../../components/ui/package-links";

export default async function Docs({params}: {params: {path?: string[]}}) {
const path = '/docs/' + (params.path?.join('/') || '');
Expand All @@ -15,6 +17,7 @@ export default async function Docs({params}: {params: {path?: string[]}}) {
link={Link}
components={{
Note,
PackageLinks,
}}
config={{
publicDirs: ['public']
Expand Down
7 changes: 4 additions & 3 deletions site/src/app/docs/[[...path]]/robindoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { initializeRobindoc } from "robindoc";

export const { Page, Sidebar, getPages, getMeta, getPageContent, getPageData } = initializeRobindoc(async () => ({
configuration: {
// sourceRoot: '../docs',
sourceRoot: 'https://github.com/vordgi/robindoc/tree/main/docs',
// sourceRoot: 'https://github.com/vordgi/robindoc/tree/main/docs',
sourceRoot: '../docs',
basePath: '/docs',
gitToken: process.env.GIT_TOKEN,
},
Expand All @@ -13,7 +13,8 @@ export const { Page, Sidebar, getPages, getMeta, getPageContent, getPageData } =
type: 'heading',
href: '/',
configuration: {
sourceRoot: 'https://github.com/vordgi/robindoc/tree/main/README.md',
// sourceRoot: 'https://github.com/vordgi/robindoc/tree/main/README.md',
sourceRoot: '..',
}
},
"auto-spreaded"
Expand Down
30 changes: 30 additions & 0 deletions site/src/components/ui/package-links/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';

import './package-links.scss';

export const PackageLinks = () => {
return (
<div className="package-links">
<a
href="https://npmjs.com/package/robindoc"
className="package-links-link package-links-link-npm"
target="_blank"
rel="noopener noreferrer"
>
<span className="package-links-link-inner">
NPM
</span>
</a>
<a
href="https://github.com/vordgi/robindoc"
className="package-links-link package-links-link-github"
target="_blank"
rel="noopener noreferrer"
>
<span className="package-links-link-inner">
GitHub
</span>
</a>
</div>
)
}
29 changes: 29 additions & 0 deletions site/src/components/ui/package-links/package-links.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.package-links {
display: grid;
grid-auto-flow: column;
justify-content: flex-start;
gap: 12px;
}

.package-links-link {
font-weight: 500;
border-radius: 6px;
text-decoration: none;
color: inherit;
padding: 2px;
}

.package-links-link-inner {
display: block;
padding: 4px 12px;
background-color: var(--body);
border-radius: 4px;
}

.package-links-link-npm {
background: linear-gradient(90deg, #f97316, #ec4899);
}

.package-links-link-github {
background: var(--neutral800);
}

0 comments on commit 12122a5

Please sign in to comment.