Skip to content

Commit a9b0936

Browse files
authored
remove Preview notice header when no previews (github#25785)
1 parent 7649667 commit a9b0936

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

components/rest/PreviewsRow.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type Props = {
99

1010
export function PreviewsRow({ slug, hasRequiredPreviews, xGitHub }: Props) {
1111
const { t } = useTranslation('products')
12+
const hasPreviews = xGitHub.previews && xGitHub.previews.length > 0
1213

1314
return (
1415
<tr>
@@ -24,7 +25,7 @@ export function PreviewsRow({ slug, hasRequiredPreviews, xGitHub }: Props) {
2425
<p className="m-0">
2526
Setting to
2627
<code>application/vnd.github.v3+json</code> is recommended.
27-
{xGitHub.previews && (
28+
{hasPreviews && (
2829
<a href={`#${slug}-preview-notices`} className="d-inline">
2930
{xGitHub.previews.length > 1
3031
? ` ${t('rest.reference.see_preview_notices')}`

components/rest/RestPreviewNotice.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function RestPreviewNotice({ slug, previews }: Props) {
2121
)
2222
})
2323

24-
return (
24+
return previews.length > 0 ? (
2525
<>
2626
<h4 id={`${slug}-preview-notices`}>
2727
{previews.length > 1
@@ -30,5 +30,5 @@ export function RestPreviewNotice({ slug, previews }: Props) {
3030
</h4>
3131
{previewNotices}
3232
</>
33-
)
33+
) : null
3434
}

0 commit comments

Comments
 (0)