docs: support since, deprecated, and feature flag tags in dml reference (#13741)

This commit is contained in:
Shahed Nasser
2025-10-13 13:31:48 +03:00
committed by GitHub
parent 958b003a11
commit 9a5ca86b76
16 changed files with 274 additions and 5 deletions

View File

@@ -0,0 +1,32 @@
import React from "react"
import { Badge, Tooltip } from "@/components"
export type DeprecatedNoticeProps = {
description?: string
tooltipTextClassName?: string
badgeClassName?: string
badgeContent?: React.ReactNode
}
export const DeprecatedNotice = ({
description,
tooltipTextClassName,
badgeClassName,
badgeContent = `Deprecated`,
}: DeprecatedNoticeProps) => {
return (
<Tooltip
tooltipChildren={
<span className={tooltipTextClassName}>
{description ||
"This feature is deprecated and may be removed in future releases."}
</span>
}
clickable
>
<Badge variant="neutral" className={badgeClassName}>
{badgeContent}
</Badge>
</Tooltip>
)
}

View File

@@ -0,0 +1,37 @@
import React from "react"
import { Badge, Tooltip } from "@/components"
export type VersionNoticeProps = {
version: string
tooltipTextClassName?: string
badgeClassName?: string
badgeContent?: React.ReactNode
}
export const VersionNotice = ({
version,
tooltipTextClassName,
badgeClassName,
badgeContent = `v${version}`,
}: VersionNoticeProps) => {
return (
<Tooltip
tooltipChildren={
<span className={tooltipTextClassName}>
This is available starting from
<br />
<a
href={`https://github.com/medusajs/medusa/releases/tag/${version}`}
>
Medusa v{version}
</a>
</span>
}
clickable
>
<Badge variant="blue" className={badgeClassName}>
{badgeContent}
</Badge>
</Tooltip>
)
}

View File

@@ -22,6 +22,8 @@ import {
import { decodeStr, isInView } from "@/utils"
import { usePathname } from "next/navigation"
import { useIsBrowser, useSiteConfig } from "../../.."
import { VersionNotice } from "../../Notices/VersionNotice"
import { DeprecatedNotice } from "../../Notices/DeprecatedNotice"
type CommonProps = ParentCommonProps & {
level?: number
@@ -236,6 +238,15 @@ const TypeListItem = ({
badgeContent={<ArrowsPointingOutMini />}
/>
)}
{item.since && (
<VersionNotice
version={item.since}
badgeClassName="!p-0 leading-none"
/>
)}
{item.deprecated?.is_deprecated && (
<DeprecatedNotice description={item.deprecated?.description} />
)}
</div>
</div>
</DetailsSummary>

View File

@@ -17,6 +17,11 @@ export type Type = {
featureFlag?: string
expandable: boolean
children?: Type[]
deprecated?: {
is_deprecated: boolean
description?: string
}
since?: string
}
type ParameterTypesType = {

View File

@@ -22,8 +22,10 @@ export * from "./Details/Summary"
export * from "./DetailsList"
export * from "./DottedSeparator"
export * from "./EditButton"
export * from "./ExpandableNotice"
export * from "./FeatureFlagNotice"
export * from "./Notices/ExpandableNotice"
export * from "./Notices/FeatureFlagNotice"
export * from "./Notices/DeprecatedNotice"
export * from "./Notices/VersionNotice"
export * from "./Feedback"
export * from "./Feedback/Solutions"
export * from "./Footer"