Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ const VulnerabilityChip: FC<VulnerabilityChipProps> = ({
const t = useTranslations();

return (
<Badge
size="small"
kind={SEVERITY_KIND_MAP[severity] as BadgeKind}
className="mr-1"
>
<Badge size="small" kind={SEVERITY_KIND_MAP[severity] as BadgeKind}>
{count > 0 ? <span className={styles.chipCount}>{count}</span> : null}
{t(`components.eolChip.severity.${severity}`)}
</Badge>
Expand Down
2 changes: 1 addition & 1 deletion apps/site/components/EOL/VulnerabilityChips/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const VulnerabilityChips: FC<VulnerabilityChipsProps> = ({
);

return (
<div className="vulnerability-chips">
<div className="flex flex-row flex-wrap gap-1 max-sm:justify-end">
{SEVERITY_ORDER.filter(severity => groupedBySeverity[severity] > 0).map(
severity => (
<VulnerabilityChip
Expand Down
18 changes: 12 additions & 6 deletions apps/site/components/Releases/PreviousReleasesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,30 @@ const PreviousReleasesTable: FC = () => {
<tbody>
{releaseData.map(release => (
<Fragment key={release.major}>
<tr key={release.major}>
<td data-label="Version">
<tr data-label={release.versionWithPrefix}>
<td data-label={t('components.downloadReleasesTable.version')}>
<Link href={`/download/archive/${release.versionWithPrefix}`}>
v{release.major}
</Link>
</td>

<td data-label="LTS">{release.codename || '-'}</td>
<td data-label={t('components.downloadReleasesTable.codename')}>
{release.codename || '-'}
</td>

<td data-label="Date">
<td
data-label={t('components.downloadReleasesTable.firstReleased')}
>
<FormattedTime date={release.currentStart} />
</td>

<td data-label="Date">
<td
data-label={t('components.downloadReleasesTable.lastUpdated')}
>
<FormattedTime date={release.releaseDate} />
</td>

<td data-label="Status">
<td data-label={t('components.downloadReleasesTable.status')}>
<Badge kind={BADGE_KIND_MAP[release.status]} size="small">
{release.status}
{release.status === 'End-of-life' ? ' (EoL)' : ''}
Expand Down
4 changes: 4 additions & 0 deletions apps/site/next.mdx.plugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import rehypeSlug from 'rehype-slug';
import remarkGfm from 'remark-gfm';
import readingTime from 'remark-reading-time';

import remarkTableTitles from './util/table';

/**
* Provides all our Rehype Plugins that are used within MDX
*/
Expand All @@ -30,4 +32,6 @@ export const REMARK_PLUGINS = [
remarkHeadings,
// Calculates the reading time of the content
readingTime,
// Adds a `data` attribute to table cells for our custom CSS
remarkTableTitles,
];
3 changes: 3 additions & 0 deletions apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"feed": "~5.1.0",
"github-slugger": "~2.0.0",
"gray-matter": "~4.0.3",
"mdast-util-to-string": "^4.0.0",
"next": "15.5.0",
"next-intl": "~4.3.4",
"next-themes": "~0.4.6",
Expand All @@ -73,6 +74,7 @@
"semver": "~7.7.2",
"sval": "^0.6.3",
"tailwindcss": "catalog:",
"unist-util-visit": "^5.0.0",
"vfile": "~6.0.3",
"vfile-matter": "~5.0.1"
},
Expand All @@ -85,6 +87,7 @@
"@opennextjs/cloudflare": "^1.6.4",
"@playwright/test": "^1.54.1",
"@testing-library/user-event": "~14.6.1",
"@types/mdast": "^4.0.4",
"@types/mdx": "^2.0.13",
"@types/semver": "~7.7.0",
"eslint-config-next": "15.5.0",
Expand Down
46 changes: 46 additions & 0 deletions apps/site/util/table.ts
Copy link
Member

@avivkeller avivkeller Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Shameless plug here, disclaimer: I wrote this package, so no need to use it if you don't want)

https://www.npmjs.com/package/remark-table-cell-titles

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a good idea. Your implementation already has tests, etc., but let's see what the rest of the team thinks first

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for this package

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import type { Root } from 'mdast';
import { toString } from 'mdast-util-to-string';
import { visit } from 'unist-util-visit';

/**
* Remark plugin that adds data-label attributes to table cells (td)
* based on their corresponding table headers (th).
*/
export default function remarkTableTitles() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent approach!

return (tree: Root) => {
visit(tree, 'table', table => {
// Ensure table has at least a header row and one data row
if (table.children.length < 2) return;

const [headerRow, ...dataRows] = table.children;

if (headerRow.children.length <= 1) {
table.data ??= {};

table.data.hProperties = {
'data-cards': 'false',
};
}

// Extract header labels from the first row
const headerLabels = headerRow.children.map(headerCell =>
toString(headerCell.children)
);

// Assign data-label to each cell in data rows
dataRows.forEach(row => {
row.children.forEach((cell, idx) => {
cell.data ??= {};

if (idx > headerLabels.length) {
return;
}

cell.data.hProperties = {
'data-label': headerLabels[idx],
};
});
});
});
};
}
3 changes: 2 additions & 1 deletion packages/ui-components/src/Common/Badge/index.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@reference "../../styles/index.css";

.badge {
@apply rounded-full
@apply whitespace-nowrap
rounded-full
text-center
text-white;

Expand Down
63 changes: 60 additions & 3 deletions packages/ui-components/src/styles/markdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,10 @@ main {
text-sm
dark:border-neutral-800;

/* Common border and text styles */
th,
td {
@apply max-xs:block
max-xs:border-l-0
border
@apply border
border-r-0
border-t-0
border-neutral-200
Expand Down Expand Up @@ -170,4 +169,62 @@ main {
@apply sm:border-l-0;
}
}

/* Mobile-specific styles */
@media (max-width: 40rem) {
table:not([data-cards='false']) {
@apply block
border-0;

thead {
@apply sr-only;
}

tbody {
@apply block
space-y-4;
}

tr {
@apply rounded-xs
block
border
border-neutral-200
p-4
before:mb-2
before:text-sm
before:font-medium
before:text-neutral-500
before:content-[attr(data-label)]
dark:border-neutral-800
dark:before:text-neutral-400;
}

td {
@apply relative
block
border-0
border-b
px-0
py-2
pl-[33%]
text-right
text-neutral-600
before:absolute
before:left-0
before:top-1/2
before:w-1/3
before:-translate-y-1/2
before:break-words
before:text-left
before:font-medium
before:text-neutral-700
before:content-[attr(data-label)]
last:border-0
dark:border-neutral-900
dark:text-neutral-300
dark:before:text-neutral-200;
}
}
}
}
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading