-
Notifications
You must be signed in to change notification settings - Fork 306
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
refactor(react-storage): Primary to composable ActionStart #5935
Conversation
|
packages/react-storage/src/components/StorageBrowser/composables/ActionStart.tsx
Outdated
Show resolved
Hide resolved
packages/react-storage/src/components/StorageBrowser/controls/ActionStartControl.tsx
Outdated
Show resolved
Hide resolved
actionStart?: { | ||
onClick?: () => void; | ||
label?: string; | ||
disabled?: boolean; | ||
}; |
There was a problem hiding this comment.
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
packages/react-storage/src/components/StorageBrowser/controls/hooks/useActionStart.tsx
Outdated
Show resolved
Hide resolved
packages/react-storage/src/components/StorageBrowser/controls/hooks/useActionStart.tsx
Outdated
Show resolved
Hide resolved
...eact-storage/src/components/StorageBrowser/views/LocationActionView/CreateFolderControls.tsx
Outdated
Show resolved
Hide resolved
...ages/react-storage/src/components/StorageBrowser/views/LocationActionView/UploadControls.tsx
Outdated
Show resolved
Hide resolved
packages/react-storage/src/components/StorageBrowser/composables/ActionStart.tsx
Outdated
Show resolved
Hide resolved
packages/react-storage/src/components/StorageBrowser/controls/types.ts
Outdated
Show resolved
Hide resolved
...ages/react-storage/src/components/StorageBrowser/views/LocationActionView/UploadControls.tsx
Outdated
Show resolved
Hide resolved
...eact-storage/src/components/StorageBrowser/views/LocationActionView/CreateFolderControls.tsx
Outdated
Show resolved
Hide resolved
packages/react-storage/src/components/StorageBrowser/controls/hooks/useActionStart.tsx
Outdated
Show resolved
Hide resolved
.../react-storage/src/components/StorageBrowser/controls/hooks/__tests__/useActionStart.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM TY
...s/react-storage/src/components/StorageBrowser/controls/__tests__/ActionStartControl.spec.tsx
Show resolved
Hide resolved
packages/react-storage/src/components/StorageBrowser/controls/hooks/useActionStart.tsx
Outdated
Show resolved
Hide resolved
packages/react-storage/src/components/StorageBrowser/controls/ActionStartControl.tsx
Outdated
Show resolved
Hide resolved
d0583b6
to
5f8c2cc
Compare
actionsConfig: { | ||
type: 'SINGLE_ACTION', | ||
isCancelable: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actionsConfig: { | |
type: 'SINGLE_ACTION', | |
isCancelable: true, | |
}, |
There was a problem hiding this comment.
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
actionsConfig: { | ||
isCancelable: true, | ||
type: 'BATCH_ACTION', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actionsConfig: { | |
isCancelable: true, | |
type: 'BATCH_ACTION', | |
}, |
There was a problem hiding this comment.
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
There was a problem hiding this 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 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
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.
actionsConfig: { | ||
type: 'BATCH_ACTION', | ||
isCancelable: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actionsConfig: { | |
type: 'BATCH_ACTION', | |
isCancelable: true, | |
}, |
same as comment above
@@ -0,0 +1,24 @@ | |||
import React from 'react'; | |||
import { ButtonElement } from '../context/elements'; |
There was a problem hiding this comment.
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
import { ButtonElement } from '../context/elements'; | |
import { ButtonElement } from '../context/elements'; |
(really need to just have an eslint rule for this)
}); | ||
|
||
afterAll(() => { | ||
useActionStartSpy.mockRestore(); |
There was a problem hiding this comment.
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?
Description of changes
Refactors the usage and implementation of Primary button to ActionStart button while making it composable.
Issue #, if available
Description of how you validated changes
Checklist
yarn test
passes and tests are updated/addeddocs
,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.