-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FR] Support for response status code examples (#176)
* Create ResponseSamples component and import into markdown index * Lint fix for imports * Add margin to ResponseSamples container * Add content type and fix styling * Fix content type for responses with multiple examples * Remove content type * Fix response tab item styling * Remove unncessary code from ResponseSamples * Refactor createStatusCodes to support example tabs * Clean up css
- Loading branch information
1 parent
c237f3b
commit 4570524
Showing
5 changed files
with
112 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
27 changes: 27 additions & 0 deletions
27
packages/docusaurus-theme-openapi-docs/src/theme/ResponseSamples/index.js
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,27 @@ | ||
/* ============================================================================ | ||
* Copyright (c) Palo Alto Networks | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* ========================================================================== */ | ||
|
||
import React from "react"; | ||
|
||
import CodeBlock from "@theme/CodeBlock"; | ||
|
||
import styles from "./styles.module.css"; | ||
|
||
function ResponseSamples({ responseExample }) { | ||
return ( | ||
<div className={styles.responseSamplesContainer}> | ||
<CodeBlock | ||
language="javascript" | ||
className={styles.responseSamplesCodeBlock} | ||
> | ||
{responseExample} | ||
</CodeBlock> | ||
</div> | ||
); | ||
} | ||
|
||
export default ResponseSamples; |
7 changes: 7 additions & 0 deletions
7
packages/docusaurus-theme-openapi-docs/src/theme/ResponseSamples/styles.module.css
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,7 @@ | ||
.responseSamplesContainer { | ||
margin-top: 2rem; | ||
} | ||
|
||
.responseSamplesTabItem { | ||
width: 100%; | ||
} |
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