-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
feat: create css-only responsive table #8098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements CSS-only responsive tables that adapt to different screen sizes using media queries and data attributes. The main change transforms tables from traditional grid layout on desktop to card-based layout on mobile screens.
- Creates mobile-friendly table layouts that stack information vertically on small screens
- Adds automatic data-label attributes to table cells via a remark plugin
- Updates existing table component to use internationalized labels
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
packages/ui-components/src/styles/markdown.css | Implements responsive table CSS with mobile card layout and desktop grid styles |
apps/site/util/table.ts | Creates remark plugin to automatically add data-label attributes to table cells |
apps/site/package.json | Adds required dependencies for markdown processing utilities |
apps/site/next.mdx.plugins.mjs | Integrates the new table plugin into the MDX processing pipeline |
apps/site/components/Releases/PreviousReleasesTable.tsx | Updates table component to use internationalized data-labels and fix rendering issues |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8098 +/- ##
==========================================
+ Coverage 75.89% 75.90% +0.01%
==========================================
Files 113 113
Lines 9459 9459
Branches 307 307
==========================================
+ Hits 7179 7180 +1
+ Misses 2279 2278 -1
Partials 1 1 ☔ View full report in Codecov by Sentry. |
<> | ||
<tr key={release.major}> | ||
<td data-label="Version">v{release.major}</td> | ||
<Fragment key={release.major}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the error Each child in a list should have a unique "key" prop.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for this package
01ba72a
to
38cccee
Compare
38cccee
to
d9f70ff
Compare
CC @nodejs/nodejs-website |
@@ -30,4 +32,5 @@ export const REMARK_PLUGINS = [ | |||
remarkHeadings, | |||
// Calculates the reading time of the content | |||
readingTime, | |||
remarkTableTitles, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Add a comment above explain this, like all the other plugins do:
remarkTableTitles, | |
// Adds a `data` attribute to table cells for our custom CSS | |
remarkTableTitles, |
* Remark plugin that adds data-label attributes to table cells (td) | ||
* based on their corresponding table headers (th). | ||
*/ | ||
export default function remarkTableTitles() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent approach!
Lighthouse Results
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Good stuff and great effort put in here :)
Appreciate you going back-and-forth on this. Looking back, this bec came much simpler and easier than the original PR :)
(Looks a bit weird tho) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT
Description
Create CSS-only responsive table
Validation
Related Issues
Fixes #7656
Check List
pnpm format
to ensure the code follows the style guide.pnpm test
to check if all tests are passing.pnpm build
to check if the website builds without errors.