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

Reuse shared components in API Policies #536

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

piyumaldk
Copy link
Contributor

$Subject

handlePolicyDownload={handlePolicyDownload}
handleDelete={handleDelete}
setDrawerOpen={setDrawerOpen}
PolicyConfigurationEditDrawer={PolicyConfigurationEditDrawer}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we passing down a component here? Can't we simply import the required component within the shared component itself (i.e. within AttachedPolicyCardShared)

Copy link
Contributor Author

@piyumaldk piyumaldk Feb 1, 2024

Choose a reason for hiding this comment

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

We cannot do that as the shared component is shared by two different features. Since those have different data contexts and different funtionalities, we cannot import them as a common identical one in the shared component. By passing them down to components, we do not need seperate implementations to identify the compoenent's feature.

currentFlow={currentFlow}
policyList={policyList}
fetchPolicies={fetchPolicies}
DraggablePolicyCard={DraggablePolicyCard}
Copy link
Contributor

Choose a reason for hiding this comment

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

Here too. Also, shall we move out the components such as FlowArrow.tsx files to the shared folder?

Copy link
Contributor Author

@piyumaldk piyumaldk Feb 1, 2024

Choose a reason for hiding this comment

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

I have used a FlowArrow.tsx shared file in the shared folder and reused them in both features. Eventhough it has only direction as a data (Which is not a problem for resuing in both features) I kept the file structure as it is for the readability. Becase if so, the only file missing will be that and I thought it will confuse people. If we need, we can completely remove it from both features as it's in the bottom of the react components of both features.

@piyumaldk piyumaldk merged commit d07d95e into wso2:main Feb 2, 2024
6 of 7 checks passed
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