refactor: rename webhook badge and make configurable

This commit is contained in:
Anya Stasiuk 2020-08-14 15:13:10 +03:00
parent 454d27f18c
commit c33a1de54e
2 changed files with 4 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import { IMenuItem, OperationModel } from '../../services';
import { shortenHTTPVerb } from '../../utils/openapi';
import { MenuItems } from './MenuItems';
import { MenuItemLabel, MenuItemLi, MenuItemTitle, OperationBadge } from './styled.elements';
import { l } from '../../services/Labels';
export interface MenuItemProps {
item: IMenuItem;
@ -91,7 +92,7 @@ export class OperationMenuItemContent extends React.Component<OperationMenuItemC
ref={this.ref}
>
{item.isWebhook ? (
<OperationBadge type="hook">hook</OperationBadge>
<OperationBadge type="hook">{l('webhook')}</OperationBadge>
) : (
<OperationBadge type={item.httpVerb}>{shortenHTTPVerb(item.httpVerb)}</OperationBadge>
)}

View File

@ -8,6 +8,7 @@ export interface LabelsConfig {
nullable: string;
recursive: string;
arrayOf: string;
webhook: string;
}
export type LabelsConfigRaw = Partial<LabelsConfig>;
@ -22,6 +23,7 @@ const labels: LabelsConfig = {
nullable: 'Nullable',
recursive: 'Recursive',
arrayOf: 'Array of ',
webhook: 'Event',
};
export function setRedocLabels(_labels?: LabelsConfigRaw) {