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

Added Possibilities to add ButtonID to Confirmation Dialog #464

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/system/NewConfirmationDialog/NewConfirmationDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const NewConfirmationDialogContent = ( {
onConfirm,
onClose,
className = null,
buttonId,
} ) => (
<Box className={ classNames( 'vip-confirmation-dialog-component', className ) }>
<Flex sx={ { justifyContent: 'flex-end', mt: 4 } }>
Expand All @@ -27,6 +28,7 @@ const NewConfirmationDialogContent = ( {
<NewDialog.Close>
<Button
variant={ buttonVariant }
id={ buttonId }
onClick={ () => {
onConfirm();
onClose();
Expand Down Expand Up @@ -56,6 +58,7 @@ const NewConfirmationDialog = ( {
buttonVariant,
title,
body = '',
buttonId,
...props
} ) => {
const directTrigger = React.cloneElement( trigger, { onClick: onConfirm } );
Expand All @@ -76,6 +79,7 @@ const NewConfirmationDialog = ( {
body={ body }
label={ label }
buttonVariant={ buttonVariant }
buttonId={ buttonId }
/>
) }
trigger={ trigger }
Expand All @@ -92,6 +96,7 @@ NewConfirmationDialog.propTypes = {
body: PropTypes.node,
label: PropTypes.node,
buttonVariant: PropTypes.string,
buttonId: PropTypes.string,
};

export { NewConfirmationDialog };
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const Default = () => {
body="A modal is used to perform more detailed actions that don&lsquo;t necessarily need the context
behind."
onConfirm={ () => setAnswer( '👍' ) }
buttonId="ConfirmIsJohnDoe"
needsConfirm={ true }
/>

Expand Down