-
Notifications
You must be signed in to change notification settings - Fork 0
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
chore: Remove ButtonIcon
#181
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Preview is readyThis pull request generated a Preview👀 Preview: https://preview-181--nextjs.preview.vtex.app |
Lighthouse ReportsHere are the Lighthouse reports of this Pull Request📝 Based on commit 342388a
|
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.
src/components/ui/Button/Button.tsx
Outdated
@@ -62,7 +62,9 @@ function Button({ | |||
disabled={disabled} | |||
{...props} | |||
> | |||
{iconPosition === 'left' && <UIIcon component={icon} />} | |||
{(!iconPosition || iconPosition === 'left') && ( |
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.
Do we need this same kind of treatment for the icon's right position?
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.
No, we don't. I did this only to support the case the user doesn't set iconPosition
property, i.e. for the icon button cases that we don't need set any position
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.
Noticed that this was causing this issue here, so I'm thinking in another way
src/components/ui/Button/Button.tsx
Outdated
@@ -62,7 +62,9 @@ function Button({ | |||
disabled={disabled} | |||
{...props} | |||
> | |||
{iconPosition === 'left' && <UIIcon component={icon} />} | |||
{(!iconPosition || iconPosition === 'left') && ( |
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.
If we don't pass the iconPosition
prop should we render the UIIcon
? I think I didn't get it well.
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.
this is confusing. I think we shouldn't render UIIcon
if not passed.
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.
the UIIcon
handles the case the icon
doesn't exist and displays nothing. I explained here my intention there
569cb69
to
116bf8f
Compare
@@ -51,6 +51,8 @@ function Button({ | |||
disabled, | |||
...props | |||
}: ButtonProps) { | |||
const isButtonIcon = icon && !iconPosition |
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.
I like it!
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.
Approved!
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.
Uhull! I've checked it again, this issue is solved and everything looks great 🌟
116bf8f
to
342388a
Compare
What's the purpose of this pull request?
This PR intends to remove the
ButtonIcon
component and all its references. It will be replaced by the regularButton
with specific data attributes for this case.How to test it?
Everything should look the same after these changes.
Checklist
Changelog
CHANGELOG.md
at the beginning of its due section. The latest version should comes first.CHANGELOG.md
. E.g., New items in thepull_request_template.md
(#4)PR Description
Breaking change
,Enhancement
,Bug
orChore
.ComponentName
component.useWindowDimensions
hook.Documentation