Skip to content

Commit 1417339

Browse files
committed
feat: release alert box
1 parent e516c0b commit 1417339

File tree

5 files changed

+52
-17
lines changed

5 files changed

+52
-17
lines changed

apps/site/components/Downloads/ReleaseModal/index.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import AlertBox from '@node-core/ui-components/Common/AlertBox';
21
import Modal from '@node-core/ui-components/Common/Modal';
32
import { useTranslations } from 'next-intl';
43
import type { FC } from 'react';
54

65
import { MinorReleasesTable } from '#site/components/Downloads/MinorReleasesTable';
76
import { ReleaseOverview } from '#site/components/Downloads/ReleaseOverview';
87
import LinkWithArrow from '#site/components/LinkWithArrow';
8+
import WithReleaseAlertBox from '#site/components/withReleaseAlertBox';
99
import type { NodeRelease } from '#site/types';
1010

1111
type ReleaseModalProps = {
@@ -32,15 +32,7 @@ const ReleaseModal: FC<ReleaseModalProps> = ({
3232

3333
return (
3434
<Modal open={isOpen} onOpenChange={closeModal} heading={modalHeading}>
35-
{release.status === 'End-of-life' && (
36-
<AlertBox
37-
title={t('components.common.alertBox.warning')}
38-
level="warning"
39-
size="small"
40-
>
41-
{t('components.releaseModal.unsupportedVersionWarning')}
42-
</AlertBox>
43-
)}
35+
<WithReleaseAlertBox status={release.status} />
4436

4537
{release.releaseAnnounceLink && (
4638
<LinkWithArrow href={release.releaseAnnounceLink}>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import AlertBox from '@node-core/ui-components/Common/AlertBox';
2+
import { useTranslations } from 'next-intl';
3+
import type { FC } from 'react';
4+
5+
import type { NodeReleaseStatus } from '#site/types';
6+
7+
type WithReleaseAlertBoxProps = {
8+
status: NodeReleaseStatus;
9+
};
10+
11+
const WithReleaseAlertBox: FC<WithReleaseAlertBoxProps> = ({ status }) => {
12+
const t = useTranslations();
13+
14+
switch (status) {
15+
case 'End-of-life':
16+
return (
17+
<AlertBox
18+
title={t('components.common.alertBox.warning')}
19+
level="warning"
20+
size="small"
21+
>
22+
{t('components.releaseModal.unsupportedVersionWarning')}
23+
</AlertBox>
24+
);
25+
default:
26+
return null;
27+
}
28+
};
29+
30+
export default WithReleaseAlertBox;

apps/site/next.mdx.use.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import WithBadgeGroup from './components/withBadgeGroup';
99
import WithBanner from './components/withBanner';
1010
import WithDownloadArchive from './components/withDownloadArchive';
1111
import WithNodeRelease from './components/withNodeRelease';
12+
import WithReleaseAlertBox from './components/withReleaseAlertBox';
1213

1314
/**
1415
* A full list of React Components that we want to pass through to MDX
@@ -23,6 +24,8 @@ export const mdxComponents = {
2324
DownloadsTable: DownloadsTable,
2425
// HOC for getting Node.js Release Metadata
2526
WithNodeRelease: WithNodeRelease,
27+
// Renders an alert box with the given release status
28+
WithReleaseAlertBox: WithReleaseAlertBox,
2629
// HOC for providing Banner Data
2730
WithBanner: WithBanner,
2831
// HOC for providing Badge Data

apps/site/pages/en/download/archive.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ layout: download-archive
1111
{version}
1212
{release.codename && ` (${release.codename})`}
1313
</h2>
14+
<WithReleaseAlertBox status={release.status} />
1415
<ReleaseOverview release={release} />
1516
<ul>
1617
<li>

packages/ui-components/styles/markdown.css

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,22 @@ main {
172172
}
173173

174174
details {
175-
h1,
176-
h2,
177-
h3,
178-
h4,
179-
h5,
180-
h6 {
181-
@apply inline;
175+
summary * {
176+
@apply inline
177+
pl-2;
178+
}
179+
180+
a {
181+
h1,
182+
h2,
183+
h3,
184+
h4,
185+
h5,
186+
h6 {
187+
@apply inline
188+
text-green-600
189+
dark:text-green-400;
190+
}
182191
}
183192
}
184193
}

0 commit comments

Comments
 (0)