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

Allow additional classes to be specified on the clean up button #1737

Merged
merged 7 commits into from
Aug 24, 2023

Conversation

rtorrero
Copy link
Contributor

Description

This PR:

  • Allows the CleanUpButton component to be provided with additional classes
  • Changes the HostList to remove the outlining of the Clean Up button by providing additional classes

This is also needed for the upcoming PR to include the Clean Up button in the sap system instances
Captura desde 2023-08-23 10-12-57

@rtorrero rtorrero added ux javascript Pull requests that update Javascript code labels Aug 23, 2023
@arbulu89 arbulu89 added the enhancement New feature or request label Aug 23, 2023
Copy link
Contributor

@arbulu89 arbulu89 left a 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}`}
Copy link
Contributor

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 = '' }) {
Copy link
Contributor

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

@rtorrero rtorrero requested a review from arbulu89 August 23, 2023 10:34
arbulu89
arbulu89 previously approved these changes Aug 23, 2023
Copy link
Contributor

@arbulu89 arbulu89 left a 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

Copy link
Member

@CDimonaco CDimonaco left a 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()}
Copy link
Member

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.

Copy link
Contributor

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

Copy link
Contributor

@arbulu89 arbulu89 left a 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 arbulu89 dismissed their stale review August 24, 2023 12:41

Don't like the new implementation

@jagabomb
Copy link
Contributor

@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.

@CDimonaco CDimonaco self-requested a review August 24, 2023 13:34
@CDimonaco
Copy link
Member

@arbulu89 I'm with you, I approved before but the new implementation with if, looks a little bit clumsy

@rtorrero
Copy link
Contributor Author

rtorrero commented Aug 24, 2023

@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

@jagabomb
Copy link
Contributor

@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',
Copy link
Contributor

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: {
Copy link
Contributor

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()}
Copy link
Contributor

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

Copy link
Contributor

@jagabomb jagabomb left a 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.

Copy link
Contributor

@arbulu89 arbulu89 left a 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':
Copy link
Contributor

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

@rtorrero rtorrero merged commit 5a74ca7 into main Aug 24, 2023
@rtorrero rtorrero deleted the cleanup-no-border branch August 24, 2023 14:47
EMaksy pushed a commit that referenced this pull request Aug 28, 2023
* Allow additional classes to be specified on the clean up button

* Add 'fit' size to button

* Add size property to CleanUpButton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request javascript Pull requests that update Javascript code ux
Development

Successfully merging this pull request may close these issues.

4 participants