UNPKG

@redocly/graphql-docs

Version:

Redocly GraphQL docs

2 lines (1 loc) 1.23 kB
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{memo as c,useMemo as l}from"react";import{useThemeHooks as d}from"@redocly/theme";import{Box as p}from"../../common/index.js";import{MiddleSection as g,RightSection as u,useStore as f}from"../../app/index.js";import{Markdown as h}from"../../markdown/index.js";import{useSettings as w}from"../../settings/index.js";import{ShareLink as x}from"../../navigation/index.js";import{StyledItemHeader as k}from"../../common/components/Headers.js";import{Annotation as S,Arguments as j,LocationList as v}from"../components/index.js";function M({name:o,path:n}){const i=f(),{markdown:a}=w(),{useTranslate:s}=d(),{translate:m}=s(),t=l(()=>i?.getDirective(o),[o,i]);return t?r(p,{"data-testid":t.name,direction:"row",wrap:"wrap",gap:"64px",children:[r(g,{"data-testid":t.name,children:[r(k,{"data-testid":"title",children:[e(x,{to:n,"aria-label":`link to ${t.name}`}),t.name]}),e(S,{"data-testid":"object-description",children:e(h,{rawMarkdown:t.description,parser:a?.parser})}),!!t.args.length&&e(j,{args:t.args,title:m("graphql.arguments.label","Arguments")})]}),t.locations.length?e(u,{children:e(v,{locations:t.locations})}):null]}):null}const B=c(M);export{B as DirectiveItem};