-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add component for API members that are marked as alpha/beta #11529
Changes from all commits
0ef77c7
300d765
072afdb
447816e
2cad5c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,12 @@ export function DocBlock({ | |
example = false, | ||
remarksCollapsible = false, | ||
deprecated = false, | ||
releaseTag = false, | ||
}) { | ||
return ( | ||
<Stack spacing="4"> | ||
{deprecated && <Deprecated canonicalReference={canonicalReference} />} | ||
{releaseTag && <ReleaseTag canonicalReference={canonicalReference} />} | ||
{summary && <Summary canonicalReference={canonicalReference} />} | ||
{remarks && ( | ||
<Remarks | ||
|
@@ -130,3 +132,30 @@ Example.propTypes = { | |
collapsible: PropTypes.bool, | ||
index: PropTypes.number, | ||
}; | ||
|
||
export function ReleaseTag({ canonicalReference }) { | ||
const getItem = useApiDocContext(); | ||
const item = getItem(canonicalReference); | ||
const MDX = useMDXComponents(); | ||
|
||
if (item.releaseTag === "Public") { | ||
return null; | ||
} | ||
|
||
return ( | ||
<MDX.ExperimentalFeature> | ||
This is in{" "} | ||
<MDX.PrimaryLink | ||
href="https://www.apollographql.com/docs/resources/product-launch-stages/#alpha--beta" | ||
target="_blank" | ||
> | ||
{item.releaseTag.toLowerCase()} stage | ||
</MDX.PrimaryLink>{" "} | ||
and is subject to breaking changes. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds a bit scary but is definitely the more efficient way to get the point across :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ya I wish we could add messages to the |
||
</MDX.ExperimentalFeature> | ||
); | ||
} | ||
|
||
ReleaseTag.propTypes = { | ||
canonicalReference: PropTypes.string.isRequired, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine there may not be a(n easy) way around it, but there have been so many times I've accidentally wound up on the prod docs at some point while browsing a preview and didn't realize it which gets so confusing. If there's a way to avoid the absolute URL here that would be amazing 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya let me see what I can do!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to hit this in a followup PR. FWIW we used this exact link in our docs prior to 3.8. There's a chance apollographql/docs#719 might fix this as well 🙂