@redocly/graphql-docs
Version:
Redocly GraphQL docs
6 lines (5 loc) • 1.34 kB
JavaScript
import{jsx as t,jsxs as l}from"react/jsx-runtime";import{useContext as I,useMemo as x}from"react";import{ThreePanelLayout as g}from"@redocly/theme";import{styled as _}from"../styled-components.js";import{Documentation as j,Item as u,Section as P,useAutomaticScrollByLocation as b,useBaseUrlPath as v}from"../navigation/index.js";import{MenuStoreContext as y}from"../menu/index.js";import{ROOT_PATH as C}from"../navigation/constants.js";import{joinPath as i}from"../navigation/utils/index.js";import{Overview as E}from"../navigation/components/Overview.js";import{GraphQlItem as M,Items as O}from"./items/index.js";import{Breadcrumbs as S}from"./components/index.js";const T=_(g)`
&& {
display: block;
}
`,d="overview";function W(){const a=I(y),r=v()||C;b(r);const h=(o,p,m,s)=>{const n=i(p,o);return t(u,{name:o,ref:s,path:n,children:t(M,{name:o,type:m,path:n})},n)},c=x(()=>a?.getGroups().map((o,p,m)=>{const{typeGroups:s,name:n}=o;return s.map((e,f)=>t(P,{item:e,baseUrl:r,groupName:f===0&&m.length>1?n:void 0,children:t(O,{useVirtualList:e.items?.length>10,items:e.items,typeGroupId:e.typeGroupId,path:i(r,e.id),renderItem:h})},e.id))}),[r,a]);return c?l(T,{"data-testid":"content-panel",children:[t(S,{}),l(j,{children:[t(u,{name:d,path:i(r,"/"),children:t(E,{})},d),c]})]}):null}export{W as DocsContent,d as OVERVIEW_ITEM_NAME};