@redocly/asyncapi-docs
Version:
Async API docs for Redocly Realm
26 lines (25 loc) • 2.6 kB
JavaScript
import{jsx as i,jsxs as e,Fragment as p}from"react/jsx-runtime";import{Tag as b}from"@redocly/theme";import{ExternalDocumentation as S}from"@redocly/openapi-docs";import c from"styled-components";import{Fragment as u}from"react/jsx-runtime";import{Block as g,Header as x,Section as t,Label as l,Value as a,ExternalDocumentationWrapper as y}from"./common";const D=n=>{const r=n.title||n.summary||n.description;return e(g,{children:[i(x,{children:"Info"}),e(t,{children:[i(l,{children:"Host:"}),i(a,{children:n.host})]}),e(t,{children:[e(l,{children:["Protocol",n.protocolVersion?" and version":"",":"]}),e(a,{children:[n.protocol,n.protocolVersion&&`, ${n.protocolVersion}`]})]}),r&&e(p,{children:[i(d,{}),n.title&&e(t,{children:[i(l,{children:"Title:"}),i(a,{children:n.title})]}),n.summary&&e(t,{children:[i(l,{children:"Summary:"}),i(a,{children:n.summary})]}),n.description&&e(t,{children:[i(l,{children:"Description:"}),i(a,{children:n.description})]})]})]})},V=n=>e(g,{children:[i(x,{children:"Variables"}),n.map(({key:r,value:o},s,m)=>e(u,{children:[e(t,{children:[i(T,{children:r}),o.default&&e(f,{children:["Default",i(b,{size:"small",borderless:!0,children:o.default})]}),o.description&&i(j,{children:o.description}),o.enum&&e(f,{children:["Enum",i(v,{children:o.enum.map(h=>i(b,{size:"small",borderless:!0,children:h},h))})]})]}),s<m.length-1&&i(d,{})]},r))]}),w=n=>e(g,{children:[i(x,{children:"Tags"}),n.map((r,o,s)=>e(u,{children:[e(t,{children:[i(a,{children:r.name}),r.description&&i(l,{children:r.description}),r.externalDocs&&i(y,{children:i(S,{externalDocs:r.externalDocs,compact:!0})})]}),o<s.length-1&&i(d,{})]},r.name))]}),H=({server:n})=>{const r=Object.entries(n.variables||{}).map(([m,h])=>({key:m,value:h})),o=n.tags&&n.tags.length>0,s=r.length>0;return e(z,{"data-component-name":"ServerOverviewSection/ServerOverviewSection",children:[D(n),s&&e(p,{children:[i(d,{}),V(r)]}),o&&e(p,{children:[i(d,{}),n.tags&&w(n.tags)]})]})},z=c.div`
display: flex;
flex-direction: column;
gap: var(--spacing-base);
`,d=c.div`
border-bottom: 1px solid var(--border-color-secondary);
`,f=c.span`
display: flex;
gap: var(--spacing-xxs);
font-size: var(--font-size-sm);
line-height: var(--line-height-sm);
color: var(--text-color-primary);
`,T=c(f)`
padding-bottom: var(--spacing-xxs);
font-weight: var(--font-weight-semibold);
`,j=c.p`
font-size: var(--font-size-sm);
line-height: var(--line-height-sm);
color: var(--text-color-primary);
margin: 0;
`,v=c.span`
display: flex;
gap: var(--spacing-xxs);
flex-wrap: wrap;
`;export{H as ServerOverviewSection};