Skip to content

Commit

Permalink
Merge pull request #1505 from BishopFox/docs/next
Browse files Browse the repository at this point in the history
Docs/next
  • Loading branch information
moloch-- authored Dec 15, 2023
2 parents b84796f + 84c4832 commit bc5c1e0
Show file tree
Hide file tree
Showing 14 changed files with 1,933 additions and 206 deletions.
5 changes: 5 additions & 0 deletions docs/sliver-docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# generated files
public/sitemap.json
public/docs.json

# code editor files
.vscode/

# dependencies
Expand Down
41 changes: 2 additions & 39 deletions docs/sliver-docs/README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# Sliver Docs

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
The source code for the Sliver documentation site.
68 changes: 18 additions & 50 deletions docs/sliver-docs/components/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Themes } from "@/util/themes";
import { faLinux, faPython } from "@fortawesome/free-brands-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import Editor, { loader } from "@monaco-editor/react";
import { Card, CardBody } from "@nextui-org/react";
import { useTheme } from "next-themes";
import React, { useRef } from "react";

Expand All @@ -15,8 +14,6 @@ export type CodeSchema = {
export type CodeViewerProps = {
script: CodeSchema;

hideHeader?: boolean;

className?: string;
};

Expand All @@ -41,6 +38,7 @@ const CodeViewer = (props: CodeViewerProps) => {

// Editor
loader.config({ paths: { vs: "/js/monaco" } });

const editorRef = useRef(null as any);
function handleEditorDidMount(editor: any, monaco: any) {
editorRef.current = editor;
Expand Down Expand Up @@ -68,53 +66,23 @@ const CodeViewer = (props: CodeViewerProps) => {
}, [theme]);

return (
<div className="grid grid-cols-12">
{!props.hideHeader ? (
<div className="col-span-12 mt-2">
<Card>
<CardBody>
<div className="flex w-full items-center">
<div className="w-full">
<div>
<div className="flex items-center text-xl monospace">
{renderScriptTypeIcon(
props.script.script_type || "",
"mr-2"
)}
{`${props.script.name}`}
</div>
<div className="flex w-full">
<div className="text-xs text-gray-500 capitalize">
{`${props.script.script_type} script - Version`}
</div>
</div>
</div>
</div>
</div>
</CardBody>
</Card>
</div>
) : (
<></>
)}
<div className={editorContainerClassName}>
<Editor
className={props.className || "min-h-[200px]"}
theme={vsTheme}
defaultLanguage={language}
defaultValue={scriptSourceCode}
onChange={(value, event) => {
setScriptSourceCode(value || "");
}}
onMount={handleEditorDidMount}
options={{
readOnly: true,
fontFamily: "Fira Code",
fontLigatures: true,
fontSize: fontSize,
}}
/>
</div>
<div className={editorContainerClassName}>
<Editor
className={props.className || "min-h-[200px]"}
theme={vsTheme}
defaultLanguage={language}
defaultValue={scriptSourceCode}
onChange={(value, event) => {
setScriptSourceCode(value || "");
}}
onMount={handleEditorDidMount}
options={{
readOnly: true,
fontFamily: "Fira Code",
fontLigatures: true,
fontSize: fontSize,
}}
/>
</div>
);
};
Expand Down
6 changes: 6 additions & 0 deletions docs/sliver-docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const nextConfig = {
images: {
unoptimized: true,
},
webpack: (config, { isServer }) => {
if (isServer) {
require('./prebuild/generate-docs');
}
return config;
}
}

module.exports = nextConfig;
Loading

0 comments on commit bc5c1e0

Please sign in to comment.