import { useRouter } from 'next/router' import { Link } from 'components/Link' import { useTranslation } from 'components/hooks/useTranslation' import type { GraphqlT } from './types' type Props = { item: GraphqlT variant: 'preview' | 'deprecation' } export function Notice({ item, variant = 'preview' }: Props) { const { locale } = useRouter() const { t } = useTranslation('products') const previewTitle = variant === 'preview' ? t('graphql.reference.preview_notice') : t('graphql.reference.deprecation_notice') const noticeStyle = variant === 'preview' ? 'note color-border-accent-emphasis color-bg-accent' : 'warning color-border-danger color-bg-danger' return (
{previewTitle}
{variant === 'preview' && item.preview ? (
{item.name} is available under the{' '}
{item.preview.title}
. {t('graphql.reference.preview_period')}
{item.name} is deprecated.