-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6d52e78
feat: create responsive css-only table
araujogui c7d05ea
feat: create remark table plugin
araujogui a34e990
fix: better row label
araujogui 01c774d
fix: remove flex container
araujogui 2c29ab8
refactor: organize rules
araujogui 5a1a852
feat: some stylish
araujogui a700d9c
fix: oops
araujogui 377c1dd
fix: array boundaries
araujogui 947d1f5
fix: break words
araujogui 81df7db
fix: align end
araujogui c885b5c
fix: disable table cards when column count is <= 1
araujogui 8bdc0f6
fix: no wrap whitespace
araujogui 88e1cf2
fix: remove description truncate
araujogui 6984175
fix: add missing labels
araujogui 8527846
feat: split minor releases columns
araujogui b4f2d0b
fix: smaller modal padding on mobile
araujogui 569eb2b
refactor: nit
araujogui 52ab65c
fix: break words
araujogui f691a91
fix: sibling anchors
araujogui 9292888
fix: review
araujogui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
apps/site/components/Releases/ReleaseOverview/ReleaseOverviewItem/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ovflowd marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| 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() { | ||
ovflowd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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], | ||
| }; | ||
araujogui marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }); | ||
| }); | ||
| }); | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.