UNPKG

@redocly/asyncapi-docs

Version:

Async API docs for Redocly Realm

18 lines (16 loc) 1.59 kB
import{jsx as o,jsxs as g}from"react/jsx-runtime";import s from"styled-components";import{memo as v}from"react";import{LayoutVariant as S}from"@redocly/config";import{Row as b,SamplesMiddlePanel as k,makeDeepLink as L}from"@redocly/openapi-docs";import{useAtomValue as e}from"jotai";import{breakpoints as w}from"@redocly/theme/core/openapi";import{H4 as x}from"@redocly/theme/components/Typography/H4";import{LinkIcon as y}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{combineUrls as A}from"@redocly/theme/core/openapi";import{Operation as P}from"./Operation.js";import{useProtocolLabels as j}from"../hooks/index.js";import{layoutAtom as D,routingBasePathAtom as O,definitionAtom as I}from"../jotai-store/app.js";import{LinkToField as R}from"./common/index.js";const J=v(({operations:i,type:a,id:d})=>{const{getProtocolLabel:c}=j(),n=e(D),p=e(I),f=e(O),u=n===S.STACKED,h=i.length?o(b,{layout:n,children:o(k,{isStacked:u,children:g($,{children:[o(R,{to:A(f,L(d,a))}),c(`${a}Label`)]})})}):null;return o(_,{"data-component-name":"OperationSection/OperationSection",children:i.map((t,m)=>{var r;const l=(r=p.operations)===null||r===void 0?void 0:r[t.id];return l?o(P,{operation:l,dataSectionId:t.dataSectionId,headerRow:m===0?h:null,id:t.id,showDivider:m!==i.length-1},t.id):null})})}),_=s.div` width: 100%; `,$=s(x)` margin-bottom: var(--spacing-lg); text-transform: capitalize; position: relative; &:hover { ${y} { opacity: 1; visibility: visible; } } @media screen and (max-width: ${w.large}) { margin: 0; } `;export{J as OperationSection};