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

refactor(react-storage): Primary to composable ActionStart #5935

Merged

Conversation

Samaritan1011001
Copy link
Member

Description of changes

Refactors the usage and implementation of Primary button to ActionStart button while making it composable.

  • Exposes ActionStartProps for a composable custom ActionStart component
  • Uses ControlContext to supply the data/information needed for the composable component to display it.
  • Introduces a useActionStart hook that converts the controlContext into props that is fed into the ResolvedComposable ActionStart component.
  • Adds tests

Issue #, if available

Description of how you validated changes

  • Next example app manual tests

Checklist

  • Have read the Pull Request Guidelines
  • PR description included
  • yarn test passes and tests are updated/added
  • PR title and commit messages follow conventional commit syntax
  • If this change should result in a version bump, changeset added (This can be done after creating the PR.) This does not apply to changes made to docs, e2e, examples, or other private packages.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Samaritan1011001 Samaritan1011001 requested a review from a team as a code owner October 22, 2024 22:33
Copy link

changeset-bot bot commented Oct 22, 2024

⚠️ No Changeset found

Latest commit: 1569c1a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Comment on lines 23 to 27
actionStart?: {
onClick?: () => void;
label?: string;
disabled?: boolean;
};
Copy link
Member

Choose a reason for hiding this comment

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

@calebpollman could you verify this is at least sort of the right place for this? I know this is all still in flux so just want to know if this is amenable as a solution now or if it's way off base and we could do better even in the interim

cshfang
cshfang previously approved these changes Oct 24, 2024
Copy link
Member

@cshfang cshfang left a comment

Choose a reason for hiding this comment

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

LGTM TY

cshfang
cshfang previously approved these changes Oct 24, 2024
Comment on lines +105 to +108
actionsConfig: {
type: 'SINGLE_ACTION',
isCancelable: true,
},
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
actionsConfig: {
type: 'SINGLE_ACTION',
isCancelable: true,
},

Copy link
Member

Choose a reason for hiding this comment

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

nit
actionsConfig is optional, can be removed if not required

Comment on lines +10 to +13
actionsConfig: {
isCancelable: true,
type: 'BATCH_ACTION',
},
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
actionsConfig: {
isCancelable: true,
type: 'BATCH_ACTION',
},

Copy link
Member

Choose a reason for hiding this comment

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

nit:
same as comment above

Copy link
Member

@ashwinkumar6 ashwinkumar6 left a comment

Choose a reason for hiding this comment

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

Thanks lgtm !!
A few nit comments

tableData,
isActionStartDisabled: disablePrimary,
actionStartLabel: 'Start',
},
actionsConfig: { type: 'BATCH_ACTION', isCancelable: true },
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
actionsConfig: { type: 'BATCH_ACTION', isCancelable: true },

nit:
Same suggestion as above on removing actionsConfig if it's not required.
Note: not sure if it's used by the DataTableControl or other components

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I didn't add it so don't want to remove it as it might be used anywhere, same for the other similar comment.

Comment on lines +338 to +341
actionsConfig: {
type: 'BATCH_ACTION',
isCancelable: true,
},
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
actionsConfig: {
type: 'BATCH_ACTION',
isCancelable: true,
},

same as comment above

@@ -0,0 +1,24 @@
import React from 'react';
import { ButtonElement } from '../context/elements';
Copy link
Contributor

@reesscot reesscot Oct 30, 2024

Choose a reason for hiding this comment

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

nit: we typically add an empty line between third party imports and local imports

Suggested change
import { ButtonElement } from '../context/elements';
import { ButtonElement } from '../context/elements';

(really need to just have an eslint rule for this)

});

afterAll(() => {
useActionStartSpy.mockRestore();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary, aren't the tests already isolated?

@Samaritan1011001 Samaritan1011001 merged commit f36904e into feat-storage-browser/main Oct 31, 2024
33 checks passed
@Samaritan1011001 Samaritan1011001 deleted the feat-sb/composability-primary branch October 31, 2024 00:51
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.

4 participants