Skip to content
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

Migrate Table to TypeScript #852

Merged
merged 27 commits into from Apr 12, 2021
Merged

Conversation

robinmetral
Copy link
Contributor

@robinmetral robinmetral commented Mar 19, 2021

Addresses #516.

Purpose

Migrate the Table component to TypeScript.

Approach and changes

  • Migrate Table component and sub-components to TypeScript
  • Various small fixes and improvements discovered during the migration ✨

Definition of done

  • Development completed
  • Reviewers assigned
  • Unit and integration tests
  • Meets minimum browser support
  • Meets accessibility requirements

@vercel
Copy link

vercel bot commented Mar 19, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sumup/oss-circuit-ui/7rPZT8ctLYQekHt9v7zqNFUEQN41
✅ Preview: https://oss-circuit-ui-git-feat-migrate-table-to-typescript-sumup.vercel.app

@sumup-clark
Copy link

sumup-clark bot commented Mar 19, 2021

Hey @robinmetral,
we are super excited that you are contributing! 🎉There's one more thing you need to do. Please accept our Contributor License Agreement. It helps you and us to collaborate on clear terms and focus on what we love most: code.

Thanks!

@robinmetral robinmetral mentioned this pull request Mar 19, 2021
49 tasks
@robinmetral robinmetral force-pushed the feat/migrate-table-to-typescript branch from 314c380 to 6f515d4 Compare March 23, 2021 16:55
@changeset-bot
Copy link

changeset-bot bot commented Mar 23, 2021

🦋 Changeset detected

Latest commit: b3c6637

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sumup/circuit-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Robin Metral added 2 commits March 26, 2021 17:28
This also passes rowheaders={false} to the rendered component because it's not what's being testes here. With row headers, the first column of the table receives a "rowheader" WAI role instead of the "cell" role that we're targeting in the tests.
@connor-baer connor-baer added the ♿ accessibility Improves usability label Mar 26, 2021
Robin Metral added 3 commits March 30, 2021 18:27
This commit also removes a custom keyboard event listener. Enter and space key down events are already handled as a click event. We were effectively triggering onClick twice - this was discovered by switching from fireEvent to userEvent. I'm leaving the test covering the keyboard event logic in the spec.
It will be assigned a value via defaultProps but should be optional from the point of view of its parents. This was breaking specs that were not explicitly passing a testid
@codecov
Copy link

codecov bot commented Mar 31, 2021

Codecov Report

Merging #852 (b3c6637) into canary (17714b7) will decrease coverage by 0.01%.
The diff coverage is 94.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           canary     #852      +/-   ##
==========================================
- Coverage   91.91%   91.89%   -0.02%     
==========================================
  Files         161      161              
  Lines        2820     2888      +68     
  Branches      717      751      +34     
==========================================
+ Hits         2592     2654      +62     
- Misses        203      208       +5     
- Partials       25       26       +1     
Impacted Files Coverage Δ
packages/circuit-ui/components/Table/constants.ts 100.00% <ø> (ø)
packages/circuit-ui/components/Table/utils.ts 92.00% <92.00%> (ø)
packages/circuit-ui/components/Table/Table.tsx 94.62% <92.68%> (ø)
...omponents/Table/components/TableHead/TableHead.tsx 91.17% <92.85%> (ø)
...omponents/Table/components/SortArrow/SortArrow.tsx 100.00% <100.00%> (ø)
...omponents/Table/components/TableBody/TableBody.tsx 100.00% <100.00%> (ø)
...components/Table/components/TableCell/TableCell.ts 100.00% <100.00%> (ø)
...nents/Table/components/TableHeader/TableHeader.tsx 100.00% <100.00%> (ø)
.../components/Table/components/TableRow/TableRow.tsx 100.00% <100.00%> (ø)
... and 1 more

@robinmetral
Copy link
Contributor Author

☝️ @connor-baer I just merged canary into this branch, tried to rebase but too many things moved around - hope that's fine with you 🙂

Just need to migrate a couple more Table sub-components, clean up types across components (import them from one place instead of redeclaring), and this will be ready for review (probably by EOW!) 🎉

@robinmetral
Copy link
Contributor Author

Codecov is suddenly unhappy, I think it's because of the null and undefined checks that we added to utils.ts to make the TS compiler happy. I think we can ignore those, it's really an internal check and shouldn't happen 🙂

Copy link
Member

@connor-baer connor-baer left a comment

Choose a reason for hiding this comment

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

Thank you so, so much for this fantastic contribution! I know how much work went into it 🙌🏻👏🏻

Copy link
Contributor Author

@robinmetral robinmetral left a comment

Choose a reason for hiding this comment

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

Thank you so much for the review! 🙌 I'm pushing most fixes in a minute, will follow-up in the individual comment threads for the rest

Copy link
Contributor Author

@robinmetral robinmetral left a comment

Choose a reason for hiding this comment

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

@connor-baer I think I addressed all the comments! I'll also check the keyboard events on different browsers now.

You can review the changes in this view (there are two commits, I had to push an extra small fix)

Copy link
Member

@connor-baer connor-baer left a comment

Choose a reason for hiding this comment

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

Thank you for addressing all my comments! Looks great 🤩

Co-authored-by: Connor Bär <connor-baer@users.noreply.github.com>
@robinmetral robinmetral changed the title feat(components): migrate Table to TypeScript Migrate Table to TypeScript Apr 12, 2021
@robinmetral robinmetral merged commit 95be224 into canary Apr 12, 2021
@robinmetral robinmetral deleted the feat/migrate-table-to-typescript branch April 12, 2021 16:11
This was referenced Apr 15, 2021
@robinmetral robinmetral mentioned this pull request Jun 2, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
♿ accessibility Improves usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants