deleteActionButton.tsx 786 B

1234567891011121314151617181920212223242526272829
  1. import type {ButtonProps} from 'sentry/components/button';
  2. import {Button} from 'sentry/components/button';
  3. import {IconDelete} from 'sentry/icons';
  4. import {t} from 'sentry/locale';
  5. interface DeleteActionButtonProps extends Omit<ButtonProps, 'onClick'> {
  6. index: number;
  7. onClick: (triggerIndex: number, index: number, e: React.MouseEvent) => void;
  8. triggerIndex: number;
  9. }
  10. export default function DeleteActionButton(
  11. props: DeleteActionButtonProps
  12. ): React.ReactElement {
  13. const handleClick = (e: React.MouseEvent) => {
  14. const {triggerIndex, index, onClick} = props;
  15. onClick(triggerIndex, index, e);
  16. };
  17. return (
  18. <Button
  19. size="sm"
  20. icon={<IconDelete />}
  21. aria-label={t('Remove action')}
  22. {...props}
  23. onClick={handleClick}
  24. />
  25. );
  26. }