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(component): add SideNavItems.tsx component #14809

Closed
wants to merge 4 commits into from

Conversation

Nirajsah
Copy link
Contributor

@Nirajsah Nirajsah commented Oct 7, 2023

Closes #13603

Detailed Description

  • In this pull request, I have introduced a new component file, SideNavItems.tsx, along with corresponding TypeScript types to enhance type safety. During the development of this component, I encountered two issues. first issue was related to propTypes, which I removed in earlier commits i found that it is required. Additionally, there was an issue related to TypeScript's ability to correctly infer types, particularly with regards to (child.type?.displayName).

To resolve the issue with TypeScript's type inference, I implemented a solution by explicitly defining the child's type as React.ComponentType. I then checked whether the displayName property existed within childType. This approach ensured that TypeScript correctly recognized and inferred the types, effectively resolving the issue.

In previous PRs, I unintentionally omitted running the tests before making the commits. I acknowledge and apologise for this oversight.

New

  • Added a new file SideNavItems.tsx along with its corresponding TypeScript types. Issue Resolution

Changed

  • None

Removed

  • None

It's important to note that all other aspects of the SideNavItems.tsx file are functioning as expected, and there are no other issues in the codebase.

Testing / Review
Reviewers can verify the changes in this PR by:

  • Examining the new SideNavItems.tsx file and its associated TypeScript types for correctness and completeness.
  • Confirming that the issue related to the isSideNavExpanded prop has been successfully resolved.
  • Ensuring that the removal of the SideNavItems.propTypes block does not introduce any new issues, as TypeScript now handles type checking.

@Nirajsah Nirajsah requested a review from a team as a code owner October 7, 2023 19:02
@netlify
Copy link

netlify bot commented Oct 7, 2023

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 6044fc1
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/652659f25c1dda00080cef64
😎 Deploy Preview https://deploy-preview-14809--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.

@netlify
Copy link

netlify bot commented Oct 7, 2023

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 6044fc1
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/652659f2be4c990008067d54
😎 Deploy Preview https://deploy-preview-14809--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.

@Nirajsah
Copy link
Contributor Author

Nirajsah commented Oct 7, 2023

ci / test:e2e failed running "yarn install --immutable --immutable-cache"

@Nirajsah Nirajsah closed this Oct 7, 2023
@Nirajsah Nirajsah reopened this Oct 7, 2023
@Nirajsah
Copy link
Contributor Author

Nirajsah commented Oct 7, 2023

I closed and then reopened the PR, and this time, all tests passed successfully. It's possible that something may have gone wrong during the initial PR's test run, but the subsequent attempt resulted in the expected test outcomes.

Copy link
Contributor

@guidari guidari left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀 Thanks for the contribution!

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.

Thanks for submitting this PR! The .tsx file should be replacing the .js one though. There's some docs here on the steps we're taking for each of these components if that's helpful.

packages/react/src/components/UIShell/SideNavItems.tsx Outdated Show resolved Hide resolved
packages/react/src/components/UIShell/SideNavItems.tsx Outdated Show resolved Hide resolved
Apologies for the formatting error; I've now rectified it.
@Nirajsah
Copy link
Contributor Author

Thanks for submitting this PR! The .tsx file should be replacing the .js one though. There's some docs here on the steps we're taking for each of these components if that's helpful.

I've reviewed the documentation and will bear it in mind.

Separating comments
@Nirajsah
Copy link
Contributor Author

some checks failed i don't know why, closing the PR. I'll try to reopen the PR for checks

@Nirajsah Nirajsah closed this Oct 11, 2023
@Nirajsah Nirajsah reopened this Oct 11, 2023
@Nirajsah
Copy link
Contributor Author

Nirajsah commented Oct 11, 2023

closing this PR. I'll Make a new PR after everything is fixed

@Nirajsah Nirajsah closed this Oct 11, 2023
@Nirajsah Nirajsah deleted the SideNavItems branch October 11, 2023 08:37
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.

Add TypeScript types to SideNavItems
3 participants