mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-08 14:14:56 +03:00
refactor: rename webhook badge and make configurable
This commit is contained in:
parent
454d27f18c
commit
c33a1de54e
|
@ -7,6 +7,7 @@ import { IMenuItem, OperationModel } from '../../services';
|
||||||
import { shortenHTTPVerb } from '../../utils/openapi';
|
import { shortenHTTPVerb } from '../../utils/openapi';
|
||||||
import { MenuItems } from './MenuItems';
|
import { MenuItems } from './MenuItems';
|
||||||
import { MenuItemLabel, MenuItemLi, MenuItemTitle, OperationBadge } from './styled.elements';
|
import { MenuItemLabel, MenuItemLi, MenuItemTitle, OperationBadge } from './styled.elements';
|
||||||
|
import { l } from '../../services/Labels';
|
||||||
|
|
||||||
export interface MenuItemProps {
|
export interface MenuItemProps {
|
||||||
item: IMenuItem;
|
item: IMenuItem;
|
||||||
|
@ -91,7 +92,7 @@ export class OperationMenuItemContent extends React.Component<OperationMenuItemC
|
||||||
ref={this.ref}
|
ref={this.ref}
|
||||||
>
|
>
|
||||||
{item.isWebhook ? (
|
{item.isWebhook ? (
|
||||||
<OperationBadge type="hook">hook</OperationBadge>
|
<OperationBadge type="hook">{l('webhook')}</OperationBadge>
|
||||||
) : (
|
) : (
|
||||||
<OperationBadge type={item.httpVerb}>{shortenHTTPVerb(item.httpVerb)}</OperationBadge>
|
<OperationBadge type={item.httpVerb}>{shortenHTTPVerb(item.httpVerb)}</OperationBadge>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -8,6 +8,7 @@ export interface LabelsConfig {
|
||||||
nullable: string;
|
nullable: string;
|
||||||
recursive: string;
|
recursive: string;
|
||||||
arrayOf: string;
|
arrayOf: string;
|
||||||
|
webhook: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type LabelsConfigRaw = Partial<LabelsConfig>;
|
export type LabelsConfigRaw = Partial<LabelsConfig>;
|
||||||
|
@ -22,6 +23,7 @@ const labels: LabelsConfig = {
|
||||||
nullable: 'Nullable',
|
nullable: 'Nullable',
|
||||||
recursive: 'Recursive',
|
recursive: 'Recursive',
|
||||||
arrayOf: 'Array of ',
|
arrayOf: 'Array of ',
|
||||||
|
webhook: 'Event',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setRedocLabels(_labels?: LabelsConfigRaw) {
|
export function setRedocLabels(_labels?: LabelsConfigRaw) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user