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

fix(Tearsheet): add missing declaration for headerActions prop #6114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wkeese
Copy link
Contributor

@wkeese wkeese commented Sep 25, 2024

Refs #546.

headerActions was defined for TearsheetShell but not for Tearsheet.

This caused Typescript errors, and you were also missing PropTypes validation for any plain Javascript code using headerActions.

Note that ideally, Tearsheet.tsx and TearsheetNarrow.tsx would not repeat the type declarations from TearsheetShell.tsx. But that's no addressed in this PR.

What did you change?

Added Tearsheet headerActions Typescript declaration, and also added it to the PropTypes.

How did you test and verify your work?

Built locally.

headerActions was defined for TearsheetShell but not for Tearsheet.

This caused Typescript errors as well as PropTypes warnings for
anyone using headerActions.

Note that ideally Tearsheet.tsx and TearsheetNarrow.tsx would not repeat
the type declarations from TearsheetShell.tsx.  But that's an orthogonal
issue.

Refs carbon-design-system#546.
@wkeese wkeese requested a review from a team as a code owner September 25, 2024 04:59
@wkeese wkeese requested review from elycheea and amal-k-joy and removed request for a team September 25, 2024 04:59
Copy link

netlify bot commented Sep 25, 2024

Deploy Preview for carbon-for-ibm-products ready!

Name Link
🔨 Latest commit e9d1ec2
🔍 Latest deploy log https://app.netlify.com/sites/carbon-for-ibm-products/deploys/66f398c9d236a50008232151
😎 Deploy Preview https://deploy-preview-6114--carbon-for-ibm-products.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.

* wide tearsheets.
*/
headerActions?: ReactNode;

Copy link
Contributor

@amal-k-joy amal-k-joy Sep 26, 2024

Choose a reason for hiding this comment

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

Hey @wkeese ,
Thanks for the changes.
I was trying to see this prop type warning in the story Tearsheet with all header items and influencer which passes headerActions prop and couldn't find any. Could you please help me to reproduce this issue ?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amal-k-joy - I guess PropTypes doesn't warn about having extra parameters. I updated the ticket description to just say that we don't have proper PropTypes validation, i.e. something like headerActions={567} would not currently be flagged.

Note that this PR is mainly for fixing the Typescript declaration, or at least that's my main goal.

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