Skip to content

Commit a4a3221

Browse files
cursoragentsergical
andcommitted
Add VersionRequirement component for SDK version requirements
Co-authored-by: sergiy.dybskiy <[email protected]>
1 parent 9ceb097 commit a4a3221

File tree

5 files changed

+37
-11
lines changed

5 files changed

+37
-11
lines changed

docs/platforms/react-native/logs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar_order: 5755
77

88
<PlatformContent includePath="llm-rules-logs" />
99

10-
<Include name="feature-stage-beta-logs-react-native.mdx" />
10+
<Include name="feature-stage-beta-logs.mdx" />
1111

1212
With Sentry Structured Logs, you can send text based log information from your applications to Sentry. Once in Sentry, these logs can be viewed alongside relevant errors, searched by text-string, or searched using their individual attributes.
1313

includes/feature-stage-beta-logs-react-native.mdx

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
Logs for React Native are supported in Sentry React Native SDK version `7.0.0-beta.1` and above. If you're on an older SDK, upgrade to `7.0.0-beta.1` or newer to use Logs.
1+
<VersionRequirement product="Logs for React Native" sdk="Sentry React Native SDK" minVersion="7.0.0-beta.1">
2+
If you're on an older SDK, upgrade to `7.0.0-beta.1` or newer to use Logs.
3+
</VersionRequirement>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import {ReactNode} from 'react';
2+
3+
import {Alert} from './alert';
4+
5+
export type VersionRequirementProps = {
6+
product: string; // e.g., "Logs for React Native"
7+
sdk: string; // e.g., "Sentry React Native SDK"
8+
minVersion: string; // e.g., "7.0.0-beta.1"
9+
level?: 'info' | 'warning' | 'success';
10+
children?: ReactNode; // additional details, upgrade notes, links
11+
};
12+
13+
/**
14+
* VersionRequirement renders a prominent callout stating the minimum SDK version
15+
* required for a given feature. It composes the shared Alert/Callout styles and
16+
* can be reused by any product area (not limited to Logs).
17+
*/
18+
export function VersionRequirement({
19+
product,
20+
sdk,
21+
minVersion,
22+
level = 'warning',
23+
children,
24+
}: VersionRequirementProps) {
25+
return (
26+
<Alert title="Version requirement" level={level}>
27+
{product} requires {sdk} version `{minVersion}` or newer.
28+
{children ? <div className="mt-2">{children}</div> : null}
29+
</Alert>
30+
);
31+
}

src/mdxComponents.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {SignInNote} from './components/signInNote';
4444
import {SmartLink} from './components/smartLink';
4545
import {TableOfContents} from './components/tableOfContents';
4646
import {VimeoEmbed} from './components/video';
47+
import {VersionRequirement} from './components/version-requirement';
4748

4849
export function mdxComponents(
4950
dynamicComponents: any = {},
@@ -93,6 +94,7 @@ export function mdxComponents(
9394
SandboxLink,
9495
SignInNote,
9596
VimeoEmbed,
97+
VersionRequirement,
9698
a: SmartLink,
9799
img: DocImage,
98100
...dynamicComponents,

0 commit comments

Comments
 (0)