-
Notifications
You must be signed in to change notification settings - Fork 951
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
Adding sortable tables #6338
Adding sortable tables #6338
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
hey @matthewshaver , this looks great! however the sortable table component doesn't seem to supported elements such as bolded or line breaks, links, etc. this is what i tested in the website/docs/docs/cloud/about-cloud/regions-ip-addresses.md file:
the front end team will know more but i wonder if the solution is it needs to use a markdown parser library to support markdown and HTML for each cell? |
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 keep getting the same error but made some changes and the deploy looks good! incredible job @matthewshaver !!!
return strippedText; | ||
}; | ||
|
||
const parseMarkdownTable = (markdown) => { |
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.
Hey Matt! This is a totally awesome implementation. Really nice work here. It was clever to include cases for different alignment codes for table rows in markdown - I always forget those syntax options exist!
Re: what I was saying in our meeting yesterday: if you really wanted to, you could wrap parseMarkdownTable
in a useMemo hook to avoid it running on every re-render for performance reasons! But I did check out the component on the enterprise perms table, adjusted some things to re-run the state, and the performance hit is negligible.
I wouldn't say it's a blocking change IMO, but feel free to update it if you want to! All in all, this LGTM. 🚢
Reverting table
What are you changing in this pull request and why?
Adding sortable tables by wrapping markdown in react.
Static tables function the same. To make a sortable table would wrap markdown table with :
I couldn't successfully format this so that the {
} are not required.
I also couldn't figure out how to enforce this globally (which was a request). It has to be implemented purposefully.
In the UI this will put light grey arrows to the right of the headers. When users click the arrows it will sort the table according to the column and the directional arrow will be darker. There is no "reset," but if the user reloads the page, the table will be in the original order if it wasn't alphabetical by the first column already (which it really should be unless it's a connections config table).
Checklist