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

feat(DataTable): add support for table row statuses #2073

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

booc0mtaco
Copy link
Contributor

@booc0mtaco booc0mtaco commented Oct 16, 2024

  • component to support standard EDS statuses per row
  • update tests and snapshots (new story for comparison)

Test Plan:

  • Wrote/updated automated tests
  • CI tests / new tests are not applicable
  • Manually tested my changes, and here are the details:

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 96.55172% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.10%. Comparing base (7ffbd56) to head (1ea5726).
Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
src/components/DataTable/DataTable.tsx 96.55% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2073      +/-   ##
==========================================
+ Coverage   97.08%   97.10%   +0.02%     
==========================================
  Files         111      111              
  Lines        2740     2766      +26     
  Branches      726      738      +12     
==========================================
+ Hits         2660     2686      +26     
  Misses         77       77              
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Oct 16, 2024

size-limit report 📦

Path Size
components 92.69 KB (+0.46% 🔺)
styles 28.82 KB (+0.56% 🔺)

@booc0mtaco booc0mtaco force-pushed the aholloway/EDS-1404 branch 11 times, most recently from bc8ffc1 to a357050 Compare October 18, 2024 21:11
@booc0mtaco booc0mtaco marked this pull request as ready for review October 18, 2024 21:16
@booc0mtaco booc0mtaco requested a review from a team October 18, 2024 21:16
columnHelper.accessor(DataTable.__StatusColumnId__, {
header: () => <DataTable.StatusHeaderCell />,
cell: (info) => <DataTable.StatusCell status={info.getValue()} />,
size: 32,
Copy link
Contributor Author

@booc0mtaco booc0mtaco Oct 18, 2024

Choose a reason for hiding this comment

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

TODO add / use some token here?

style={{
width: `${header.getSize()}px`,
}}
<DataTableContext.Provider value={{ size }}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of this diff is whitespace changes. Use the ⚙️ above to update the view to hide whitespace changes.

Comment on lines +234 to +239
const columnWidth =
header.getSize() !== 150
? `${header.getSize()}px`
: undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to investigate how TanStack Table sets the column width. .getSize is always defined, and defaults to 150px. Marking this value as special here b/c all sizings will be based on token unit sizes (16 * x) and 150 doesn't land on one of those boundaries (... 144, 160, 176, ...)

export type {
DataTableProps,
DataTableRowProps,
DataTableWithStatus,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Utility type for augmenting table model data with the details of the status type in the type object.

- component to support standard EDS statuses per row
- update tests and snapshots (new story for comparison)
Copy link
Contributor

@timzchang timzchang left a comment

Choose a reason for hiding this comment

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

looks good to me!

@booc0mtaco
Copy link
Contributor Author

thanks @timzchang !

@booc0mtaco booc0mtaco merged commit c109f52 into next Oct 18, 2024
12 checks passed
@booc0mtaco booc0mtaco deleted the aholloway/EDS-1404 branch October 18, 2024 23:42
@booc0mtaco booc0mtaco mentioned this pull request Oct 18, 2024
booc0mtaco added a commit that referenced this pull request Oct 21, 2024
## [15.5.0](v15.4.1...v15.5.0) (2024-10-18)

[Storybook](https://61313967cde49b003ae2a860-gtyxxzokxd.chromatic.com/)

### Features

* **DataTable:** add support for table row statuses ([#2073](#2073)) ([c109f52](c109f52))
* re-export HeadlessUI's Transition component ([#2069](#2069)) ([a4a5fc8](a4a5fc8))


### Bug Fixes

* **DataTable:** fix cell size and border in FF ([#2072](#2072)) ([7ffbd56](7ffbd56))
* **Select:** remove label checks from component ([#2068](#2068)) ([8ede09d](8ede09d))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants