Skip to content

Conversation

@InsaneZein
Copy link
Collaborator

@InsaneZein InsaneZein commented Jan 23, 2024

Closes #92
Add RemoveModal from rbac-ui

RemoveModal

@fhlavac
Copy link
Contributor

fhlavac commented Jan 24, 2024

One styling thing - the title should be black like so
image

Comment on lines 6 to 10
const useStyles = createUseStyles({
rbacDeleteIcon: {
marginRight: 'var(--pf-v5-global--spacer--xs)'
},
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be needed

Suggested change
const useStyles = createUseStyles({
rbacDeleteIcon: {
marginRight: 'var(--pf-v5-global--spacer--xs)'
},
})
const useStyles = createUseStyles({
rbacDeleteIcon: {
marginRight: 'var(--pf-v5-global--spacer--xs)'
},
})

Comment on lines 25 to 26
/** Custom message after confirmation */
confirmCheckMessage: string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Custom message after confirmation */
confirmCheckMessage: string,
/** Custom checkbox message */
checkboxMessage: string,

isOpen,
confirmButtonLabel,
withCheckbox=false,
confirmCheckMessage,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
confirmCheckMessage,
checkboxMessage='I understand that this action cannot be undone.',

@fhlavac
Copy link
Contributor

fhlavac commented Jan 24, 2024

@InsaneZein just some nitpicking to be consistent with WarningModal as much as possible, thank you! 🙂

@InsaneZein
Copy link
Collaborator Author

@fhlavac I've added the RemoveModal functionality in WarningModal like we talked about.

Comment on lines 13 to 14
/** Custom message after confirmation */
confirmCheckMessage?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename it to checkboxLabel since checkbox uses label as well

Suggested change
/** Custom message after confirmation */
confirmCheckMessage?: string;
/** Custom checkbox label */
checkboxLabel?: string;

/** Custom label for the cancel action button */
cancelButtonLabel? : string;
cancelButtonLabel?: string;
/** Whether Modal requires a checkbox before confirming */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Whether Modal requires a checkbox before confirming */
/** Whether modal requires a checkbox before confirming */

Comment on lines 15 to 16
/** Whether confirm button will show up as red or not */
dangerButtonVariant?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to pass "confirmButtonVariant" of type ButtonVariant from PF

variant = ModalVariant.small,
titleIconVariant = 'warning',
withCheckbox = false,
confirmCheckMessage='',
Copy link
Contributor

@fhlavac fhlavac Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should provide a default message - this is what we use in RBAC remove modals

Suggested change
confirmCheckMessage='',
checkboxLabel='I understand that this action cannot be undone.',

isChecked={checked}
onChange={() => setChecked(!checked)}
label={confirmCheckMessage}
id="remove-modal-check"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id="remove-modal-check"
id="warning-modal-check"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also enhance this example to use custom button labels?
Just to have them present somewhere

title='Unsaved changes'
onClose={() => setIsOpen(false)}
onConfirm={() => setIsOpen(false)}
withCheckbox={true}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
withCheckbox={true}
withCheckbox

@fhlavac
Copy link
Contributor

fhlavac commented Jan 26, 2024

@InsaneZein looks great!
Sorry for nitpicking around the prop names, just want to make it as consistent with PF as possible to avoid future API breaking changes for target apps

Copy link
Contributor

@fhlavac fhlavac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@InsaneZein looks great! Can you please just add a feat(): prefix to one of the commits so a release triggers? Feel free to merge it then

@InsaneZein InsaneZein merged commit c4b1386 into main Jan 29, 2024
@github-actions
Copy link

🎉 This PR is included in version 5.1.0-prerelease.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate RBAC remove modal

3 participants