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

chore: add decorator in dataTable #18114

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

preetibansalui
Copy link
Contributor

Closes #18005

Add decorator in dataTable component

Changelog

Added a new component TableDecoratorRow
Added a new deprecated warning function for components

Changed

  1. marked slug as deprecated prop in all dataTable components
  2. marked TableSlugRow component as deprecated
  3. Added few decorators in storybook as ai-lable and decorator both.

Testing / Reviewing

  1. Go to Storybook > DataTable > AILabel story
  2. Check each story under that, All AI slug stories are now a mix of slug and decorator, so all should look fine.
  3. Added few examples of decorator Tooltip as well, that too should look fine.

Copy link

netlify bot commented Nov 19, 2024

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit ff2e40c
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/676aa9f56ce2e10008e6a4c0
😎 Deploy Preview https://deploy-preview-18114--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 19, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit ff2e40c
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/676aa9f502f4dd0008e1f572
😎 Deploy Preview https://deploy-preview-18114--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 19, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ff2e40c
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/676aa9f54f6f9b0008085058
😎 Deploy Preview https://deploy-preview-18114--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@ariellalgilmore ariellalgilmore left a comment

Choose a reason for hiding this comment

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

thanks for tackling the data table!!! this is looking really good! left some comments, but lmk if you have any questions!

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 40.32258% with 37 lines in your changes missing coverage. Please review.

Project coverage is 84.15%. Comparing base (03170a8) to head (ff2e40c).

Files with missing lines Patch % Lines
...act/src/components/DataTable/TableDecoratorRow.tsx 20.00% 12 Missing ⚠️
...ackages/react/src/prop-types/deprecateComponent.js 10.00% 7 Missing and 2 partials ⚠️
...ges/react/src/components/DataTable/TableHeader.tsx 53.84% 6 Missing ⚠️
.../react/src/components/DataTable/TableExpandRow.tsx 63.63% 4 Missing ⚠️
...ckages/react/src/components/DataTable/TableRow.tsx 42.85% 4 Missing ⚠️
...es/react/src/components/DataTable/TableSlugRow.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18114      +/-   ##
==========================================
- Coverage   84.31%   84.15%   -0.17%     
==========================================
  Files         404      406       +2     
  Lines       14359    14407      +48     
  Branches     4656     4636      -20     
==========================================
+ Hits        12107    12124      +17     
- Misses       2090     2119      +29     
- Partials      162      164       +2     

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

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

LGTM! Worth calling out that this more tightly couples this prop with AILabel due to the few instances where the display name is checked. e.g. decorator?.type?.displayName === 'AILabel'. It's not a huge deal, but it does mean things will behave differently if someone implements their own AILabel, as unlikely as that may be.


const didWarnAboutDeprecation = {};

export default function deprecateComponent(componentName, message) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm surprised we didn't have this already, thanks for adding it!

Copy link
Member

@ariellalgilmore ariellalgilmore left a comment

Choose a reason for hiding this comment

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

looking good just a few minor comments! happy to discuss more too!

@@ -98,15 +107,15 @@ const TableExpandRow = React.forwardRef(
[`${prefix}--parent-row`]: true,
[`${prefix}--expandable-row`]: isExpanded,
[`${prefix}--data-table--selected`]: isSelected,
[`${prefix}--data-table--slug-row`]: rowHasSlug,
[`${prefix}--data-table--ai-label-row`]: rowHasAILabel,
Copy link
Member

Choose a reason for hiding this comment

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

I think we need both untill v12... people could be targetting these classes

Suggested change
[`${prefix}--data-table--ai-label-row`]: rowHasAILabel,
[`${prefix}--data-table--slug-row`]: slug && rowHasAILabel,
[`${prefix}--data-table--ai-label-row`]: rowHasAILabel,

Copy link
Contributor Author

@preetibansalui preetibansalui Dec 10, 2024

Choose a reason for hiding this comment

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

Hey Ari, here Slug is just a constant name which I have changed to decorator in line no 78 of this file and added condition for both Slug or decorator. However, yes we can add both the classes [${prefix}--data-table--slug-row] and [${prefix}--data-table--ai-label-row] on same condition keeping in mind if any user is using the [${prefix}--data-table--slug-row] class name.

packages/react/src/components/DataTable/TableHeader.tsx Outdated Show resolved Hide resolved
packages/react/src/components/DataTable/TableRow.tsx Outdated Show resolved Hide resolved
packages/react/src/components/DataTable/tools/normalize.js Outdated Show resolved Hide resolved
@preetibansalui
Copy link
Contributor Author

thanks for tackling the data table!!! this is looking really good! left some comments, but lmk if you have any questions!

Thanks Ari, I have added the comment and made the changes wherever possible. Please review.

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

it looks like the snapshots may need an update to pass CI!

Copy link
Member

@ariellalgilmore ariellalgilmore left a comment

Choose a reason for hiding this comment

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

LGTM! just don't forget to put the data table stories back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decorator: DataTable
4 participants