mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-27 11:03:43 +03:00
feat: sideNavStyle new option
This commit is contained in:
parent
eb096b69be
commit
4e5636f81b
|
@ -246,6 +246,7 @@ You can use all of the following options with the standalone version of the <red
|
||||||
* `sideNavStyle` - can be specified in various ways:
|
* `sideNavStyle` - can be specified in various ways:
|
||||||
* **summary-only**: displays a summary in the sidebar navigation item. (**default**)
|
* **summary-only**: displays a summary in the sidebar navigation item. (**default**)
|
||||||
* **path-only**: displays a path in the sidebar navigation item.
|
* **path-only**: displays a path in the sidebar navigation item.
|
||||||
|
* **id-only**: displays the operation id with a fallback to the path in the sidebar navigation item.
|
||||||
|
|
||||||
### `<redoc>` theme object
|
### `<redoc>` theme object
|
||||||
* `spacing`
|
* `spacing`
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { MDXComponentMeta } from './MarkdownRenderer';
|
||||||
export enum SideNavStyleEnum {
|
export enum SideNavStyleEnum {
|
||||||
SummaryOnly = 'summary-only',
|
SummaryOnly = 'summary-only',
|
||||||
PathOnly = 'path-only',
|
PathOnly = 'path-only',
|
||||||
|
IdOnly = 'id-only',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RedocRawOptions {
|
export interface RedocRawOptions {
|
||||||
|
@ -170,6 +171,8 @@ export class RedocNormalizedOptions {
|
||||||
return value;
|
return value;
|
||||||
case SideNavStyleEnum.PathOnly:
|
case SideNavStyleEnum.PathOnly:
|
||||||
return SideNavStyleEnum.PathOnly;
|
return SideNavStyleEnum.PathOnly;
|
||||||
|
case SideNavStyleEnum.IdOnly:
|
||||||
|
return SideNavStyleEnum.IdOnly;
|
||||||
default:
|
default:
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,12 @@ export class OperationModel implements IMenuItem {
|
||||||
|
|
||||||
this.name = getOperationSummary(operationSpec);
|
this.name = getOperationSummary(operationSpec);
|
||||||
|
|
||||||
this.sidebarLabel = options.sideNavStyle === SideNavStyleEnum.PathOnly ? this.path : this.name;
|
this.sidebarLabel =
|
||||||
|
options.sideNavStyle === SideNavStyleEnum.IdOnly
|
||||||
|
? this.operationId || this.path
|
||||||
|
: options.sideNavStyle === SideNavStyleEnum.PathOnly
|
||||||
|
? this.path
|
||||||
|
: this.name;
|
||||||
|
|
||||||
if (this.isCallback) {
|
if (this.isCallback) {
|
||||||
// NOTE: Callbacks by default should not inherit the specification's global `security` definition.
|
// NOTE: Callbacks by default should not inherit the specification's global `security` definition.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user