deleteActionButton.tsx 750 B

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