Skip to content

Commit

Permalink
refactor(form-builder): add trash icon to confirm delete button
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard authored and bjoerge committed Apr 8, 2021
1 parent 7edf026 commit 2a61514
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,24 @@ export function ConfirmDeleteButton(props: {
}) {
const {onConfirm, placement = 'left', disabled} = props
const id = useId()

return (
<MenuButton
button={<Button icon={TrashIcon} mode="bleed" disabled={disabled} />}
id={id || ''}
button={<Button mode="bleed" icon={TrashIcon} disabled={disabled} />}
placement={placement}
portal={false}
menu={
<Menu>
<MenuItem color="danger" onClick={onConfirm} tone="critical" text={props.title} />
<MenuItem
color="danger"
icon={TrashIcon}
onClick={onConfirm}
text={props.title}
tone="critical"
/>
</Menu>
}
placement={placement}
portal={false}
/>
)
}

0 comments on commit 2a61514

Please sign in to comment.