Skip to content

Commit 532fa04

Browse files
authored
Convert some relative imports in theme package (#237)
1 parent 947efc5 commit 532fa04

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

packages/docusaurus-plugin-openapi/src/plugin-openapi.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,31 @@ declare module "@theme/MarkdownItem" {
132132
const MarkdownItem: (props: Props) => JSX.Element;
133133
export default MarkdownItem;
134134
}
135+
136+
declare module "@theme/ApiDemoPanel" {
137+
import type { Metadata } from "@theme/ApiItem";
138+
139+
export interface Props {
140+
readonly item: NonNullable<Metadata["api"]>;
141+
}
142+
143+
const ApiDemoPanel: (props: Props) => JSX.Element;
144+
export default ApiDemoPanel;
145+
}
146+
147+
declare module "@theme/ApiDemoPanel/Curl" {
148+
import type { Request } from "postman-collection";
149+
150+
export interface Props {
151+
readonly postman: Request;
152+
readonly codeSamples: Array<Any>;
153+
}
154+
155+
const Curl: (props: Props) => JSX.Element;
156+
export default Curl;
157+
}
158+
159+
declare module "@theme/ApiDemoPanel/Response" {
160+
const Response: () => JSX.Element;
161+
export default Response;
162+
}

packages/docusaurus-theme-openapi/src/theme/ApiDemoPanel/Curl/index.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
import React, { useRef, useState, useEffect } from "react";
99

1010
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
11+
import type { Props } from "@theme/ApiDemoPanel/Curl";
1112
import clsx from "clsx";
1213
// @ts-ignore
1314
import codegen from "postman-code-generators";
14-
import sdk from "postman-collection";
1515
import Highlight, { defaultProps } from "prism-react-renderer";
1616

1717
import { useTypedSelector } from "../hooks";
@@ -122,11 +122,6 @@ const languageTheme = {
122122
],
123123
};
124124

125-
interface Props {
126-
postman: sdk.Request;
127-
codeSamples: any; // TODO: Type this...
128-
}
129-
130125
function Curl({ postman, codeSamples }: Props) {
131126
// TODO: match theme for vscode.
132127

packages/docusaurus-theme-openapi/src/theme/ApiDemoPanel/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
import React from "react";
99

1010
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
11-
import { Metadata } from "@theme/ApiItem";
11+
import type { Props } from "@theme/ApiDemoPanel";
12+
import Curl from "@theme/ApiDemoPanel/Curl";
13+
import Response from "@theme/ApiDemoPanel/Response";
1214
import { ParameterObject } from "docusaurus-plugin-openapi/src/openapi/types";
1315
import sdk from "postman-collection";
1416
import { Provider } from "react-redux";
@@ -18,18 +20,16 @@ import Accept from "./Accept";
1820
import Authorization from "./Authorization";
1921
import { createAuth } from "./Authorization/slice";
2022
import Body from "./Body";
21-
import Curl from "./Curl";
2223
import Execute from "./Execute";
2324
import MethodEndpoint from "./MethodEndpoint";
2425
import ParamOptions from "./ParamOptions";
2526
import { createPersistanceMiddleware } from "./persistanceMiddleware";
26-
import Response from "./Response";
2727
import Server from "./Server";
2828
import { createServer } from "./Server/slice";
2929
import { createStoreWithState } from "./store";
3030
import styles from "./styles.module.css";
3131

32-
function ApiDemoPanel({ item }: { item: NonNullable<Metadata["api"]> }) {
32+
function ApiDemoPanel({ item }: Props) {
3333
const { siteConfig } = useDocusaurusContext();
3434
const themeConfig = siteConfig.themeConfig as ThemeConfig;
3535
const options = themeConfig.api;

0 commit comments

Comments
 (0)