UNPKG

@redocly/graphql-docs

Version:

Redocly GraphQL docs

6 lines (5 loc) 1.48 kB
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}from"../navigation/components/index.js";import{useAutomaticScrollByLocation as b}from"../navigation/hooks/use-automatic-scroll-by-location.js";import{useBaseUrlPath as v}from"../navigation/hooks/use-base-url-path.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 z(){const a=I(y),r=v()||C;b(r);const f=(o,p,n,s)=>{const m=i(p,o);return t(u,{name:o,ref:s,path:m,children:t(M,{name:o,type:n,path:m})},m)},c=x(()=>a?.getGroups().map((o,p,n)=>{const{typeGroups:s,name:m}=o;return s.map((e,h)=>t(P,{item:e,baseUrl:r,groupName:h===0&&n.length>1?m:void 0,children:t(O,{useVirtualList:e.items?.length>10,items:e.items,typeGroupId:e.typeGroupId,path:i(r,e.id),renderItem:f})},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{z as DocsContent,d as OVERVIEW_ITEM_NAME};