MCPcopy Create free account
hub / github.com/github/docs / Previews

Function Previews

components/graphql/Previews.tsx:14–56  ·  view source on GitHub ↗
({ schema }: Props)

Source from the content-addressed store, hash-verified

12}
13
14export function Previews({ schema }: Props) {
15 const previews = schema.map((item) => {
16 const slugger = new GithubSlugger()
17 const slug = slugger.slug(item.title)
18 const { t } = useTranslation('products')
19
20 return (
21 <div className={cx(styles.markdownBody, styles.automatedPages)} key={slug}>
22 <h2 id={slug}>
23 <LinkIconHeading slug={slug} />
24 {item.title}
25 </h2>
26 <p>{item.description}</p>
27 <p>{t('graphql.overview.preview_header')}</p>
28 <pre>
29 <code>{item.accept_header}</code>
30 </pre>
31 <p>{t('graphql.overview.preview_schema_members')}:</p>
32 <ul>
33 {item.toggled_on.map((change) => (
34 <li key={change + slug}>
35 <code>{change}</code>
36 </li>
37 ))}
38 </ul>
39 {item.announcement && (
40 <p>
41 <b>{t('graphql.overview.announced')}: </b>
42 <a href={item.announcement.url}>{item.announcement.date}</a>
43 </p>
44 )}
45 {item.updates && (
46 <p>
47 <b>{t('graphql.overview.updates')}: </b>
48 <a href={item.updates.url}>{item.updates.date}</a>
49 </p>
50 )}
51 </div>
52 )
53 })
54
55 return <div>{previews}</div>
56}

Callers

nothing calls this directly

Calls 1

useTranslationFunction · 0.90

Tested by

no test coverage detected