linkWithConfirmation.tsx 744 B

1234567891011121314151617181920212223242526272829303132333435
  1. import {ButtonProps} from 'sentry/components/button';
  2. import Confirm from 'sentry/components/confirm';
  3. import Anchor from './anchor';
  4. type Props = {
  5. message: React.ReactNode;
  6. onConfirm: () => void;
  7. title: string;
  8. children?: React.ReactNode;
  9. className?: string;
  10. disabled?: boolean;
  11. priority?: ButtonProps['priority'];
  12. };
  13. /**
  14. * <Confirm> is a more generic version of this component
  15. */
  16. function LinkWithConfirmation({
  17. className,
  18. disabled,
  19. title,
  20. children,
  21. ...otherProps
  22. }: Props) {
  23. return (
  24. <Confirm {...otherProps} disabled={disabled}>
  25. <Anchor href="#" className={className} disabled={disabled} title={title}>
  26. {children}
  27. </Anchor>
  28. </Confirm>
  29. );
  30. }
  31. export default LinkWithConfirmation;