ui-components icon indicating copy to clipboard operation
ui-components copied to clipboard

Re-arrange common.ts and React specific exports

Open syedszeeshan opened this issue 11 months ago • 6 comments

Acceptance Criteria:

-Move Margins out of common.ts into a new types.ts -Any Props (e.g. GoabTabsProps, GoabTableProps, etc), move them out of common.ts into their corresponding tsx components if not already there -replace existing Margins import statements to import from "common/types.ts"; -update index.ts to export common/types.ts

When creating a new React app, 2. We want to be able to build without @abgov/ui-components-common in package.json 3. Import only from the @abgov/react-components

Desired Result After the above changes, it eliminates the dependency on "@abgov/ui-components-common" and all you need is import "@abgov/react-components"

syedszeeshan avatar Mar 19 '25 00:03 syedszeeshan

@syedszeeshan In future could you please add acceptance criteria to the issue?

Spark450 avatar Mar 20 '25 20:03 Spark450

@Spark450 @ArakTaiRoth I mentioned this in our daily standup, but I think I should have mentioned it somewhere in this new user story also, that it is a continuation/improvement of #2389

Vanessa, Chris and I discussed and we decided to do the changes that you see in the new PR #2484 ..... but since US 2389 was already merged and closed, I created this new US for myself, just for tracking purpose. I could have made these changes without creating a new US also.

I have updated the Acceptance criteria.

syedszeeshan avatar Mar 25 '25 03:03 syedszeeshan

Okay, thanks @syedszeeshan !

Spark450 avatar Mar 25 '25 16:03 Spark450

QA Testing

In ui-components/playground/react there is intellisense to import types: Image

In a separate react project there is no intellisense to import types, although Quick Fix > import works: Image

However, in that separate project if we install "@abgov/ui-components-common" then intellisense comes along with that: Image

@syedszeeshan we had discussion about a workaround without needing intellisense in VSCode is to use Quick fix the import the type. But, in my opinion this shouldn't be needed.

BumbleB2na avatar Mar 28 '25 18:03 BumbleB2na

As discussed in the Dev meeting:

I think the PR does the job as outlined in the acceptance criteria. I will let the team decide on whether this VSCode specific issue is a blocker for this PR.

Below is a quick overview, for future reference

WebStorm 1-manually importing the type works 2-Hover mouse on the missing reference, and click "Insert import" works 3-The keyboard shortcut "Alt+Shift+Enter" also works fine (which is like the equivalent of Ctrl+Space in VSCode)

VSCode 1-manual import works 2-Hover Mouse on the missing reference, and click on "Quick Fix" works 3-For the shortcut "Ctrl+Space", the VSCode intellisense does not give suggestions for some of the types like 'GoabInputOnChangeDetail' but it does work for types like 'GoabFormItem'

syedszeeshan avatar Mar 31 '25 17:03 syedszeeshan

Found a way to get intellisense to work like it used to: https://github.com/GovAlta/ui-components/pull/2484#pullrequestreview-2777077691

BumbleB2na avatar Apr 17 '25 22:04 BumbleB2na

Closing, as this story is no longer needed

ArakTaiRoth avatar Apr 29 '25 15:04 ArakTaiRoth