feat(ActionButton): use button component for action button#1358
Open
ethanashaw wants to merge 5 commits into
Open
feat(ActionButton): use button component for action button#1358ethanashaw wants to merge 5 commits into
ethanashaw wants to merge 5 commits into
Conversation
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
Updates ActionButton to render the shared Button component so it can accept additional Button props (e.g. hasIcon), and demonstrates this in Storybook via ConfirmationModal.
Changes:
- Switch
ActionButtonfrom a native<button>to the shared<Button>component and widen its spread props toButtonProps. - Attempt to add ref support to
Buttonvia arefprop. - Update
ConfirmationModalStorybook story to show an icon + label confirm button usinghasIcon.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/components/ActionButton/ActionButton.tsx | Renders Button instead of native button and expands accepted props to ButtonProps. |
| src/components/Button/Button.tsx | Adds a ref field to the exported prop type in an attempt to support refs. |
| src/components/ConfirmationModal/ConfirmationModal.stories.tsx | Demonstrates icon+label confirm button using confirmButtonProps.hasIcon. |
Comments suppressed due to low confidence (1)
src/components/ActionButton/ActionButton.tsx:180
ActionButtonrelies onref.currentto measure the button size, but passingref={ref}to<Button />will not attach the ref unlessButtonforwards refs. As-is,ref.currentwill stay null and the loader sizing logic won’t run. Either switchButtontoforwardRef(preferred) or revert this component to rendering a native<button>and manually apply the needed Button classes/props.
<Button
className={buttonClasses}
ref={ref}
onClick={isDisabled ? onClickDisabled : onClick}
aria-disabled={isDisabled || undefined}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Done
I changed
ActionButtonto use theButtoncomponent instead of the default HTMLbutton, allowing for the extra props.I made a change to one of the
ConfirmationModalstories showing this off. We needed to include an icon for a confirmation button, but the button couldn't be styled with thehasIconprop before.QA
Pinging @canonical/react-library-maintainers for a review.
Storybook
To see rendered examples of all react-components, run:
QA in your project
from
react-componentsrun:Install the resulting tarball in your project with:
QA steps
Percy steps