-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
034ed5e
commit c078726
Showing
8 changed files
with
116 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
import { Card } from "react-bootstrap"; | ||
import { useEffect } from "react"; | ||
|
||
declare var SwaggerUIBundle: any; // imported via the layout | ||
|
||
export const SwaggerCard = () => { | ||
return ( | ||
<Card bg="primary"> | ||
<Card.Header>API Endpoints</Card.Header> | ||
<Card.Body></Card.Body> | ||
</Card> | ||
); | ||
useEffect(() => { | ||
SwaggerUIBundle({ | ||
dom_id: "#swaggerContainer", | ||
url: `/api/swagger`, | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIBundle.SwaggerUIStandalonePreset, | ||
], | ||
deepLinking: true, | ||
docExpansion: "none", | ||
filter: true, | ||
}); | ||
}, []); | ||
|
||
return <div id="swaggerContainer" />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from "react"; | ||
|
||
export type LayoutProps = { | ||
title: string; | ||
}; | ||
|
||
const swaggerVersion = "5.13.0"; | ||
|
||
export const SwaggerLayout = (props: React.PropsWithChildren<LayoutProps>) => { | ||
return ( | ||
<React.StrictMode> | ||
<html lang="en"> | ||
<head> | ||
<meta charSet="UTF-8" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0" | ||
/> | ||
|
||
<link | ||
rel="stylesheet" | ||
href={`https://unpkg.com/swagger-ui-dist@${swaggerVersion}/swagger-ui.css`} | ||
/> | ||
<script | ||
src={`https://unpkg.com/swagger-ui-dist@${swaggerVersion}/swagger-ui-bundle.js`} | ||
></script> | ||
|
||
<title>{props.title}</title> | ||
</head> | ||
<body>{props.children}</body> | ||
</html> | ||
</React.StrictMode> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Container, Row, Col } from "react-bootstrap"; | ||
import { mount } from "../util/browser"; | ||
import { SwaggerLayout } from "../layouts/swagger"; | ||
import { SwaggerCard } from "../components/SwaggerCard"; | ||
|
||
export default function Page() { | ||
return ( | ||
<SwaggerLayout title="API Endpoints"> | ||
<Container> | ||
<Row> | ||
<Col md={12}> | ||
<SwaggerCard /> | ||
</Col> | ||
</Row> | ||
</Container> | ||
</SwaggerLayout> | ||
); | ||
} | ||
|
||
mount(Page); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters