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

Function Notice

components/graphql/Notice.tsx:12–51  ·  view source on GitHub ↗
({ item, variant = 'preview' }: Props)

Source from the content-addressed store, hash-verified

10}
11
12export function Notice({ item, variant = 'preview' }: Props) {
13 const { locale } = useRouter()
14
15 const { t } = useTranslation('products')
16 const previewTitle =
17 variant === 'preview'
18 ? t('rest.reference.preview_notice')
19 : t('graphql.reference.deprecation_notice')
20 const noticeStyle =
21 variant === 'preview'
22 ? 'note color-border-accent-emphasis color-bg-accent'
23 : 'warning color-border-danger color-bg-danger'
24 return (
25 <div className={`${noticeStyle} extended-markdown border rounded-1 my-3 p-3 f5`}>
26 <p>
27 <b>{previewTitle}</b>
28 </p>
29 {variant === 'preview' && item.preview ? (
30 <p>
31 <code>{item.name}</code> is available under the{' '}
32 <Link href={item.preview.href} locale={locale}>
33 {item.preview.title}
34 </Link>
35 . {t('graphql.reference.preview_period')}
36 </p>
37 ) : item.deprecationReason ? (
38 <div>
39 <p>
40 <code>{item.name}</code> is deprecated.
41 </p>
42 <div
43 dangerouslySetInnerHTML={{
44 __html: item.deprecationReason,
45 }}
46 />
47 </div>
48 ) : null}
49 </div>
50 )
51}

Callers

nothing calls this directly

Calls 1

useTranslationFunction · 0.90

Tested by

no test coverage detected