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 11 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 9134a4b
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/67599794cda7ad0008959443
😎 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 9134a4b
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/6759979437039f00087fb6b3
😎 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 9134a4b
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/675997944481a600083fd130
😎 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 39.34426% with 37 lines in your changes missing coverage. Please review.

Project coverage is 83.99%. Comparing base (8502d7a) to head (9db81fc).

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.16%   83.99%   -0.17%     
==========================================
  Files         404      406       +2     
  Lines       14350    14398      +48     
  Branches     4599     4629      +30     
==========================================
+ Hits        12077    12094      +17     
- Misses       2112     2141      +29     
- Partials      161      163       +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!

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