dxc-technology / halstack-react

Library of components for building SPAs with React and Halstack Design System
https://developer.dxc.com/halstack/
Apache License 2.0
15 stars 14 forks source link

Removed circular dependencies #1858

Closed Mil4n0r closed 6 months ago

Mil4n0r commented 7 months ago

Checklist

Description While reviewing #1854, we discovered that there were multiple circular dependencies inside the project which, in some scenarios, could cause issues.

In this PR, we are fixing the remaining ones that are:

src/number-input/NumberInput.tsx <--> src/text-input/TextInput.tsx
src/nav-tabs/NavTabs.tsx <--> src/nav-tabs/Tabs.tsx
src/accordion-group/AccordionGroup.tsx <--> src/accordion-group/AccordionGroupAccordion.tsx

To address those issues, I have moved the logic related to the respective contexts (which were the ones causing the circular dependencies) outside the component file, following the same pattern that was used for SideNavContext.

Jialecl commented 7 months ago

The context files should not be located in the layout folder.

Mil4n0r commented 7 months ago

The context files should not be located in the layout folder.

I agree, I did it because there was already the SideNav context there, but it does not make that much sense.

We should discuss what the appropiate location would be. In my opinion the lib/src/[component]/ directory is fine(maybe adding a context/ additional folder inside).

Jialecl commented 7 months ago

We should discuss what the appropiate location would be. In my opinion the lib/src/[component]/ directory is fine(maybe adding a context/ additional folder inside).

I think in the lib/src/[component]/ is the correct path there is no need to add an additional level to the path.