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(ui): migrate Panel, PanelBody and PanelFooter components to Typescript #606

Merged
merged 19 commits into from
Nov 27, 2024

Conversation

guoda-puidokaite
Copy link
Contributor

@guoda-puidokaite guoda-puidokaite commented Nov 13, 2024

Summary

  • Migrated Panel, PanelBody and PanelFooter components to TypeScript, enhancing code quality, maintainability, and scalability.
  • Utilised static typing to minimize runtime errors and improve the development experience.
  • Refactored the components for cleaner, more maintainable code.
  • Exposed deprecated .js components as Portal is used (which is in progress).
  • Improved Storybook types and documentation. NOTE: Please make sure to check the old code for correct types. Live Storybook is incorrect.
  • NOTE: Removed ContentArea and ContentAreaWrapper from Stories already as they're deprecated.

Changes Made

TypeScript Migration:

  • Converted Panel, PanelBody and PanelFooter components files to TypeScript.
  • Added comprehensive type annotations.
  • Added old .js components to the deprecated_js folder.
  • Exported deprecated components as Portal is used (which is in progress).

Refactoring:

  • Made necessary adjustments to address TypeScript-detected issues.
  • Further refactored for cleaner and more understandable code.

Testing:

  • Added edge cases:
    • Panel
      • Rendering panel without props
      • Rendering panel with undefined className
      • Rendering panel without a heading
      • Clicking close button when panel is already closed
      • Double-click on close button
    • PanelBody
      • Render without any props
      • Render with null children
      • Render with undefined children
      • Applies default styles
      • Renders multiple children
      • Renders no children
    • PanelFooter
      • Render without any props
      • Applies default styles
      • Renders multiple children
      • Renders no children
  • Organised tests by what they check for better readability and maintenance.
  • Verified components behaviour using Storybook.
  • Updated tests to use vitest.

Documentation:

  • Improved Storybook documentation types and comments.

Release:

  • Generated a changeset file.

Related Issues

Testing Instructions

  1. Check Storybook

Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • My changes generate no new warnings or errors.

Copy link

changeset-bot bot commented Nov 13, 2024

🦋 Changeset detected

Latest commit: 6af2b12

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudoperators/juno-ui-components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@guoda-puidokaite guoda-puidokaite self-assigned this Nov 13, 2024
@guoda-puidokaite guoda-puidokaite added enhancement New feature or request package All tasks related to package under packages/ ui-components All tasks related to juno-ui-components library refactor labels Nov 13, 2024
Copy link
Contributor

github-actions bot commented Nov 13, 2024

PR Preview Action v1.4.8
Preview removed because the pull request was closed.
2024-11-27 13:36 UTC

@guoda-puidokaite guoda-puidokaite changed the title chore(ui): migrate Panel, PanelBody and PanelFooter components to Typescript DRAFT chore(ui): migrate Panel, PanelBody and PanelFooter components to Typescript Nov 14, 2024
@barsukov barsukov changed the title DRAFT chore(ui): migrate Panel, PanelBody and PanelFooter components to Typescript chore(ui): migrate Panel, PanelBody and PanelFooter components to Typescript Nov 18, 2024
@barsukov barsukov added the draft label Nov 18, 2024
Copy link
Contributor

@barsukov barsukov left a comment

Choose a reason for hiding this comment

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

Great job and few breaking changes :)

@guoda-puidokaite
Copy link
Contributor Author

guoda-puidokaite commented Nov 19, 2024

Hey, @barsukov.
I've marked this PR as a draft. Having issues with the stories, need to find a solution once I've some time after training.
The blocking change is very helpful though 🙏. Might even be related to the issue I'm facing. Thank You for the early review! 💪

@guoda-puidokaite guoda-puidokaite marked this pull request as ready for review November 25, 2024 14:34
@guoda-puidokaite guoda-puidokaite requested review from franzheidl and a team as code owners November 25, 2024 14:34
barsukov
barsukov previously approved these changes Nov 26, 2024
Copy link
Contributor

@barsukov barsukov left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@ArtieReus ArtieReus left a comment

Choose a reason for hiding this comment

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

reviewing :)

Copy link
Collaborator

@ArtieReus ArtieReus left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@barsukov barsukov left a comment

Choose a reason for hiding this comment

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

LGTM

@guoda-puidokaite guoda-puidokaite merged commit 5d186c7 into main Nov 27, 2024
15 checks passed
@guoda-puidokaite guoda-puidokaite deleted the guoda-convert-panel-to-ts branch November 27, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request package All tasks related to package under packages/ refactor ui-components All tasks related to juno-ui-components library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK](ui): Migrate Panel(All related like Body and footer) component to TypeScript
4 participants