-
Notifications
You must be signed in to change notification settings - Fork 15
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
Allow additional classes to be specified on the clean up button #1737
Conversation
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.
Could you add a new story book entry with the outlined example?
return ( | ||
<Button | ||
type="primary-white" | ||
className="inline-block mx-0.5 border-green-500 border w-fit" | ||
className={`${baseClasses} ${className}`} |
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.
Can we use classNames
?
import classNames from 'classnames';
@@ -5,11 +5,13 @@ import { EOS_CLEANING_SERVICES } from 'eos-icons-react'; | |||
import Button from '@components/Button'; | |||
import Spinner from '@components/Spinner'; | |||
|
|||
function CleanUpButton({ cleaning, onClick }) { | |||
function CleanUpButton({ cleaning, onClick, className = '' }) { |
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.
You don't need to default to empty string I think.
I would work without default as 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.
Thank you!
I don't know if @jagabomb wants to have a look before merging
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.
Good job, LGTM
The comment is completely up to you, we can leave it for future reference and discussion, feel free to merge :D
return ( | ||
<Button | ||
type="primary-white" | ||
className="inline-block mx-0.5 border-green-500 border w-fit" | ||
className={buttonClasses} | ||
size="small" | ||
disabled={cleaning} | ||
onClick={() => onClick()} |
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.
Just a comment, when we have this "dummy" components, without any particular logic on the event handlers, for example take a modal which has on the onClose
prop the id of something passed like onClose(id)
, that is a complex handler.
In that button we have a direct onclick handler, without any logic and it's a common pratice, but totally optional, to pass directly the handler, like onClick={onClick}
, so the entire event chain of the dom event is passed up to the parent. The parent can listen if want to the event as first argument of the onClick prop callback.
This is completely optional in that case, there are different opinions about that, for sure it's true in pure design systems component, take bootstrap for example, you want to give the callee the direct facade to the html event.
If you want change it, otherwise leave as is and we could have this comment as a future discussion.
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.
Actually, now that I read this, I'm wondering how it works (JS mysteries to me XD).
Because in the component, we have () => onClick()
, but in the call to the component we have:
onClick={() => {
openDeregistrationModal(item);
openDeregistrationModal(item);
}}
so it is kind of done twice.
Sorry for my JS dummy questions hehe
Maybe it is totally normal
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.
@rtorrero @jagabomb
I have to confess that for me this implentation is a step back.
I think that we could achieve the same keeping the button using some styles.
If using the link is mandatory, i would create other component. This if
thing looks a bad implementation.
It doesn't have the spinning state neither
@arbulu89 I think you might be right, maybe using the Button component is overkill and maybe we need a simpler TextLink component which does the same thing as a the Button component but removes the additional padding? Just a thought from my side. |
@arbulu89 I'm with you, I approved before but the new implementation with if, looks a little bit clumsy |
a465922
to
b982d0d
Compare
@jagabomb i've updated the component to add a variant with a size setting that allows to fit the button to the available size. If this still continues to be an issue, do you mind if we solve it in a separate PR to avoid stalling this? I need this component to submit the next PR and I think there we will be able to show how it looks and if the issue is a problem. WDYT? PS: I can later add an additional component, something like but I'd need a bit of time to do a better implementation |
@rtorrero I am happy for us to proceed. My feedback is all proactive so it can always be addressed later. |
export const NoOutline = { | ||
args: { | ||
...Default.args, | ||
className: 'border-none shadow-none', |
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.
Could we put size: 'fit'
as the example
@@ -13,6 +13,13 @@ export default { | |||
}, | |||
}, | |||
onClick: { action: 'Click button' }, | |||
className: { |
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.
Add size
to the options
return ( | ||
<Button | ||
type="primary-white" | ||
className="inline-block mx-0.5 border-green-500 border w-fit" | ||
className={buttonClasses} | ||
size="small" | ||
disabled={cleaning} | ||
onClick={() => onClick()} |
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.
Actually, now that I read this, I'm wondering how it works (JS mysteries to me XD).
Because in the component, we have () => onClick()
, but in the call to the component we have:
onClick={() => {
openDeregistrationModal(item);
openDeregistrationModal(item);
}}
so it is kind of done twice.
Sorry for my JS dummy questions hehe
Maybe it is totally normal
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, feedback will be addressed later.
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.
Good to go from my side
@@ -5,6 +5,8 @@ const getSizeClasses = (size) => { | |||
switch (size) { | |||
case 'small': | |||
return 'py-1 px-2 text-sm'; | |||
case 'fit': |
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.
We could even add a story for this
* Allow additional classes to be specified on the clean up button * Add 'fit' size to button * Add size property to CleanUpButton
Description
This PR:
This is also needed for the upcoming PR to include the Clean Up button in the sap system instances