Skip to content

Commit 31400af

Browse files
committed
refactor: minor versions table
1 parent 2eaa893 commit 31400af

File tree

7 files changed

+116
-73
lines changed

7 files changed

+116
-73
lines changed
Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,29 @@
11
@reference "../../../styles/index.css";
22

3-
.links {
3+
.additionalLinks {
44
@apply flex
55
h-4
66
items-center
77
gap-2;
88
}
99

10+
.items {
11+
@apply flex
12+
h-9
13+
gap-2;
14+
}
15+
1016
.scrollable {
1117
@apply scrollbar-thin
1218
flex
13-
max-h-[21rem]
14-
snap-y
15-
snap-mandatory
19+
max-h-[29rem]
1620
overflow-y-auto;
21+
}
1722

18-
thead {
19-
@apply rounded-t-xs
20-
sticky
21-
top-px
22-
bg-white
23-
shadow-[0_-1px_0_0_var(--color-neutral-200)]
24-
dark:bg-neutral-950
25-
dark:shadow-[0_-1px_0_0_var(--color-neutral-800)];
26-
}
27-
28-
thead th {
29-
@apply last:md:w-56;
30-
}
23+
.information {
24+
@apply md:w-96;
25+
}
3126

32-
tr {
33-
@apply snap-start;
34-
}
27+
.links {
28+
@apply md:w-44;
3529
}

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

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
'use client';
22

3+
import { CodeBracketSquareIcon } from '@heroicons/react/24/outline';
34
import Separator from '@node-core/ui-components/Common/Separator';
5+
import NpmIcon from '@node-core/ui-components/Icons/PackageManager/Npm';
46
import { useTranslations } from 'next-intl';
57
import type { FC } from 'react';
68

79
import Link from '#site/components/Link';
10+
import LinkWithArrow from '#site/components/LinkWithArrow';
811
import { BASE_CHANGELOG_URL } from '#site/next.constants.mjs';
912
import type { MinorVersion } from '#site/types';
1013
import { getNodeApiLink } from '#site/util/getNodeApiLink';
1114

1215
import styles from './index.module.css';
16+
import { ReleaseOverviewItem } from '../ReleaseOverview';
1317

1418
type MinorReleasesTableProps = {
1519
releases: Array<MinorVersion>;
@@ -18,19 +22,21 @@ type MinorReleasesTableProps = {
1822
export const MinorReleasesTable: FC<MinorReleasesTableProps> = ({
1923
releases,
2024
}) => {
21-
const t = useTranslations('components.minorReleasesTable');
25+
const t = useTranslations('components');
2226

2327
return (
2428
<div className={styles.scrollable}>
2529
<table>
2630
<thead>
2731
<tr>
28-
<th>{t('version')}</th>
29-
<th>{t('links')}</th>
32+
<th>{t('minorReleasesTable.version')}</th>
33+
<th className={styles.information}>
34+
{t('minorReleasesTable.information')}
35+
</th>
36+
<th className={styles.links}>{t('minorReleasesTable.links')}</th>
3037
</tr>
3138
</thead>
3239
<tbody>
33-
<tr />
3440
{releases.map(release => (
3541
<tr key={release.version}>
3642
<td>
@@ -39,20 +45,49 @@ export const MinorReleasesTable: FC<MinorReleasesTableProps> = ({
3945
</Link>
4046
</td>
4147
<td>
42-
<div className={styles.links}>
48+
<div className={styles.items}>
49+
{release.modules && (
50+
<>
51+
<ReleaseOverviewItem
52+
Icon={CodeBracketSquareIcon}
53+
title={`v${release.modules}`}
54+
subtitle={t('releaseOverview.nApiVersion')}
55+
/>
56+
<Separator orientation="vertical" />
57+
</>
58+
)}
59+
{release.npm && (
60+
<>
61+
<ReleaseOverviewItem
62+
Icon={NpmIcon}
63+
title={`v${release.npm}`}
64+
subtitle={t('releaseOverview.npmVersion')}
65+
/>
66+
<Separator orientation="vertical" />
67+
</>
68+
)}
69+
<ReleaseOverviewItem
70+
Icon={CodeBracketSquareIcon}
71+
title={`v${release.v8}`}
72+
subtitle={t('releaseOverview.v8Version')}
73+
/>
74+
</div>
75+
</td>
76+
<td>
77+
<div className={styles.additionalLinks}>
4378
<Link
4479
kind="neutral"
45-
href={`${BASE_CHANGELOG_URL}${release.version}`}
80+
href={getNodeApiLink(`v${release.version}`)}
4681
>
47-
{t('actions.changelog')}
82+
{t('minorReleasesTable.actions.docs')}
4883
</Link>
4984
<Separator orientation="vertical" />
50-
<Link
85+
<LinkWithArrow
5186
kind="neutral"
52-
href={getNodeApiLink(`v${release.version}`)}
87+
href={`${BASE_CHANGELOG_URL}${release.version}`}
5388
>
54-
{t('actions.docs')}
55-
</Link>
89+
{t('minorReleasesTable.actions.changelog')}
90+
</LinkWithArrow>
5691
</div>
5792
</td>
5893
</tr>

apps/site/components/Downloads/ReleaseOverview/index.module.css

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@
1515
gap-4
1616
lg:grid-cols-3;
1717
}
18+
}
1819

19-
.item {
20-
@apply flex
21-
items-center
22-
gap-2;
20+
.item {
21+
@apply flex
22+
items-center
23+
gap-2;
2324

24-
h1 {
25-
@apply text-sm
26-
font-semibold;
27-
}
25+
dt {
26+
@apply text-sm
27+
font-semibold;
28+
}
2829

29-
h2 {
30-
@apply text-xs
31-
font-normal;
32-
}
30+
dd {
31+
@apply text-xs
32+
font-normal;
33+
}
3334

34-
svg {
35-
@apply size-4;
36-
}
35+
svg {
36+
@apply size-4;
3737
}
3838
}

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@ import type { NodeRelease } from '#site/types';
1313

1414
import styles from './index.module.css';
1515

16-
type ItemProps = {
16+
type ReleaseOverviewItemProps = {
1717
Icon: FC<SVGProps<SVGSVGElement>>;
1818
title: ReactNode;
1919
subtitle: ReactNode;
2020
};
2121

22-
const Item: FC<ItemProps> = ({ Icon, title, subtitle }) => {
23-
return (
24-
<div className={styles.item}>
25-
<Icon />
26-
<div>
27-
<h2>{subtitle}</h2>
28-
<h1>{title}</h1>
29-
</div>
30-
</div>
31-
);
32-
};
22+
export const ReleaseOverviewItem: FC<ReleaseOverviewItemProps> = ({
23+
Icon,
24+
title,
25+
subtitle,
26+
}) => (
27+
<div className={styles.item}>
28+
<Icon />
29+
<dl>
30+
<dd>{subtitle}</dd>
31+
<dt>{title}</dt>
32+
</dl>
33+
</div>
34+
);
3335

3436
type ReleaseOverviewProps = {
3537
release: NodeRelease;
@@ -41,36 +43,36 @@ export const ReleaseOverview: FC<ReleaseOverviewProps> = ({ release }) => {
4143
return (
4244
<div className={styles.root}>
4345
<div className={styles.container}>
44-
<Item
46+
<ReleaseOverviewItem
4547
Icon={CalendarIcon}
4648
title={<FormattedTime date={release.currentStart} />}
4749
subtitle={t('components.releaseOverview.firstReleased')}
4850
/>
49-
<Item
51+
<ReleaseOverviewItem
5052
Icon={ClockIcon}
5153
title={<FormattedTime date={release.releaseDate} />}
5254
subtitle={t('components.releaseOverview.lastUpdated')}
5355
/>
54-
<Item
56+
<ReleaseOverviewItem
5557
Icon={Square3Stack3DIcon}
5658
title={release.minorVersions.length}
5759
subtitle={t('components.releaseOverview.minorVersions')}
5860
/>
5961
{release.modules && (
60-
<Item
62+
<ReleaseOverviewItem
6163
Icon={CodeBracketSquareIcon}
6264
title={`v${release.modules}`}
6365
subtitle={t('components.releaseOverview.nApiVersion')}
6466
/>
6567
)}
6668
{release.npm && (
67-
<Item
69+
<ReleaseOverviewItem
6870
Icon={NpmIcon}
6971
title={`v${release.npm}`}
7072
subtitle={t('components.releaseOverview.npmVersion')}
7173
/>
7274
)}
73-
<Item
75+
<ReleaseOverviewItem
7476
Icon={CodeBracketSquareIcon}
7577
title={`v${release.v8}`}
7678
subtitle={t('components.releaseOverview.v8Version')}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,26 @@ layout: download-archive
3434
tarball.
3535
</li>
3636
</ul>
37-
<h2>Binary Downloads</h2>
38-
<DownloadsTable source={binaries} />
39-
<h2>Installer Packages</h2>
40-
<DownloadsTable source={installers} />
41-
<h2>Minor versions</h2>
42-
<MinorReleasesTable releases={release.minorVersions} />
4337
<details>
4438
<summary>
45-
<h2 className="inline">Other releases</h2>
39+
<h3>Other releases</h3>
4640
</summary>
4741
<ul>
4842
{majorVersions.map(version => (
4943
<li key={version}>
5044
<Link href={`/download/${version}`}>
51-
<h3>Node.js {version}</h3>
45+
<h4>Node.js {version}</h4>
5246
</Link>
5347
</li>
5448
))}
5549
</ul>
5650
</details>
51+
<h2>Binary Downloads</h2>
52+
<DownloadsTable source={binaries} />
53+
<h2>Installer Packages</h2>
54+
<DownloadsTable source={installers} />
55+
<h2>Minor versions</h2>
56+
<MinorReleasesTable releases={release.minorVersions} />
5757
</>
5858
)}
5959
</WithDownloadArchive>

packages/i18n/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
"version": "Version",
180180
"links": "Links",
181181
"showMore": "Show more",
182+
"information": "Version Informations",
182183
"actions": {
183184
"release": "Release",
184185
"changelog": "Changelog",
@@ -343,4 +344,4 @@
343344
},
344345
"logo": "Node.js logo"
345346
}
346-
}
347+
}

packages/ui-components/styles/markdown.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,15 @@ main {
170170
@apply sm:border-l-0;
171171
}
172172
}
173+
174+
details {
175+
h1,
176+
h2,
177+
h3,
178+
h4,
179+
h5,
180+
h6 {
181+
@apply inline;
182+
}
183+
}
173184
}

0 commit comments

Comments
 (0)