feat(site): show deprecation message on template page (#11996)

This commit is contained in:
Bruno Quaresma
2024-02-02 14:13:35 +00:00
committed by GitHub
parent 2e378b4894
commit 9b930f8fad
2 changed files with 30 additions and 9 deletions
@@ -26,3 +26,14 @@ export const CanNotUpdate: Story = {
},
},
};
export const Deprecated: Story = {
args: {
template: {
...MockTemplate,
deprecated: true,
deprecation_message:
"This template is not going to be used anymore. [See details](#details).",
},
},
};
@@ -35,6 +35,7 @@ import {
} from "components/MoreMenu/MoreMenu";
import Divider from "@mui/material/Divider";
import { Pill } from "components/Pill/Pill";
import { MemoizedInlineMarkdown } from "components/Markdown/Markdown";
type TemplateMenuProps = {
templateName: string;
@@ -203,20 +204,29 @@ export const TemplatePageHeader: FC<TemplatePageHeaderProps> = ({
)}
<div>
<PageHeaderTitle>
{template.display_name.length > 0
? template.display_name
: template.name}
</PageHeaderTitle>
<Stack direction="row" alignItems="center" spacing={1}>
<PageHeaderTitle>
{template.display_name.length > 0
? template.display_name
: template.name}
</PageHeaderTitle>
{template.deprecated && <Pill type="warning">Deprecated</Pill>}
</Stack>
{template.description !== "" && (
{template.deprecation_message !== "" ? (
<PageHeaderSubtitle condensed>
{template.description}
<MemoizedInlineMarkdown>
{template.deprecation_message}
</MemoizedInlineMarkdown>
</PageHeaderSubtitle>
) : (
template.description !== "" && (
<PageHeaderSubtitle condensed>
{template.description}
</PageHeaderSubtitle>
)
)}
</div>
{template.deprecated && <Pill type="warning">Deprecated</Pill>}
</Stack>
</PageHeader>
</Margins>