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