Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-merge(redoc): An attempt to use redoc for API documentation #7601

Closed
wants to merge 3 commits into from
Closed
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
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@
"@emotion/core": "^11.0.0",
"@emotion/react": "^11.11.0",
"@emotion/styled": "^11.0.0",
"@loadable/component": "^5.15.3",
"@mdx-js/mdx": "^1.6.18",
"@mdx-js/react": "^1.6.18",
"@sentry-internal/global-search": "^0.5.7",
"@sentry/browser": "7.55.2",
"@sentry/webpack-plugin": "2.2.2",
"@types/dompurify": "^3.0.2",
"@types/js-cookie": "^3.0.3",
"@types/jest": "^29.5.3",
"@types/js-cookie": "^3.0.3",
"@types/js-yaml": "^3.0.0",
"@types/node": "^20.3.1",
"@types/node": "^20.4.6",
"@types/react": "18.2.12",
"@types/react-dom": "18.2.5",
"@types/react-helmet": "^6.1.0",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"babel-preset-gatsby": "^3.11.0",
"bootstrap": "4.6.1",
"crypto-browserify": "^3.12.0",
"dompurify": "^3.0.3",
Expand Down Expand Up @@ -58,6 +60,7 @@
"js-cookie": "^3.0.5",
"js-yaml": "^3.0.0",
"jsdom": "^22.1.0",
"mobx": "^6.10.0",
"platformicons": "^5.6.0",
"prism-sentry": "^1.0.2",
"prismjs": "^1.27.0",
Expand All @@ -69,10 +72,12 @@
"react-helmet": "^5.2.1",
"react-popper": "^2.2.4",
"react-select": "^5.7.3",
"redoc": "^2.0.0",
"remark-deflist": "^0.2.1",
"sass": "^1.62.1",
"search-insights": "^2.2.3",
"stream-browserify": "^3.0.0",
"styled-components": "^5.0.5",
"ts-node": "^10.9.1",
"typescript": "^5.1.3"
},
Expand Down Expand Up @@ -113,7 +118,7 @@
"test": "jest"
},
"volta": {
"node": "18.16.0",
"node": "20.5.0",
"yarn": "1.22.5"
}
}
5 changes: 5 additions & 0 deletions src/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export function Navbar({platforms}: Props) {
API
</SmartLink>
</Nav.Item>
<Nav.Item>
<SmartLink className="nav-link" to="/redoc-api/">
Redoc Demo
</SmartLink>
</Nav.Item>
<Nav.Item>
<Nav.Link href="https://changelog.getsentry.com/">Changelog</Nav.Link>
</Nav.Item>
Expand Down
17 changes: 17 additions & 0 deletions src/components/redocLoader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import {RedocStandalone} from 'redoc';

export function RedocLoader() {
console.log('gets to the component');
const isSSR = typeof window === 'undefined';
console.log(isSSR);
return (
<RedocStandalone
specUrl="http://localhost:3000/open-api-new.json"
options={{
nativeScrollbars: true,
theme: {colors: {primary: {main: '#dd5522'}}},
}}
/>
);
}
5 changes: 5 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ function IndexPage() {
API
</SmartLink>
</Nav.Item>
<Nav.Item>
<SmartLink className="nav-link" to="/redoc-api/">
Redoc API
</SmartLink>
</Nav.Item>
<Nav.Item>
<Nav.Link href="https://changelog.getsentry.com/">Changelog</Nav.Link>
</Nav.Item>
Expand Down
11 changes: 11 additions & 0 deletions src/pages/redoc-api/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Redoc Demo
---

import { RedocLoader } from "../../components/redocLoader";
import { Navbar } from "../../components/navbar";

<div>
<Navbar />
<RedocLoader />
</div>
Loading
Loading