@redocly/portal-plugin-async-api
Version:
Async API plugin for Redocly products
44 lines • 1.66 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import AsyncApiComponent from '@asyncapi/react-component';
import styled from 'styled-components';
import { Breadcrumbs as ThemeBreadcrumbs } from '@redocly/theme';
// @ts-ignore has no exported member error
import { usePageSharedData } from '@portal/hooks';
import '@asyncapi/react-component/styles/default.css';
import { StylesProvider } from './styles';
function AsyncApiDocs({ pageProps }) {
const { settings = {} } = pageProps;
const asyncApiDefinition = usePageSharedData('AsyncApiDefinition');
const { schemaId, hideOperations, hideInfo, hideMessages, hideSchemas, hideServers } = settings;
const componentConfig = {
schemaID: schemaId,
show: {
errors: true,
info: !hideInfo,
operations: !hideOperations,
servers: !hideServers,
messages: !hideMessages,
schemas: !hideSchemas,
sidebar: false,
},
expand: {
messageExamples: false,
},
sidebar: {
showServers: 'byDefault',
showOperations: 'byDefault',
},
publishLabel: 'PUBLISHER',
subscribeLabel: 'SUBSCRIBER',
sendLabel: 'SEND',
receiveLabel: 'RECEIVE',
requestLabel: 'REQUEST',
replyLabel: 'REPLY',
};
return (_jsxs(StylesProvider, { children: [_jsx(Breadcrumbs, {}), _jsx(AsyncApiComponent, { schema: asyncApiDefinition, config: componentConfig })] }));
}
export default AsyncApiDocs;
const Breadcrumbs = styled(ThemeBreadcrumbs) `
margin-top: 20px;
`;
//# sourceMappingURL=template.js.map