You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DeleteItemButton.native.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // @flow
  2. import { translate } from '../../base/i18n';
  3. import { IconTrash } from '../../base/icons';
  4. import { connect } from '../../base/redux';
  5. import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
  6. import { deleteRecentListEntry } from '../actions';
  7. export type Props = AbstractButtonProps & {
  8. /**
  9. * The redux {@code dispatch} function.
  10. */
  11. dispatch: Function,
  12. /**
  13. * The ID of the entry to be deleted.
  14. */
  15. itemId: Object,
  16. /**
  17. * The function to be used to translate i18n labels.
  18. */
  19. t: Function
  20. };
  21. /**
  22. * A recent list menu button which deletes the selected entry.
  23. */
  24. class DeleteItemButton extends AbstractButton<Props, *> {
  25. accessibilityLabel = 'welcomepage.recentListDelete';
  26. icon = IconTrash;
  27. label = 'welcomepage.recentListDelete';
  28. /**
  29. * Handles clicking / pressing the button.
  30. *
  31. * @private
  32. * @returns {void}
  33. */
  34. _handleClick() {
  35. const { dispatch, itemId } = this.props;
  36. dispatch(deleteRecentListEntry(itemId));
  37. }
  38. }
  39. export default translate(connect()(DeleteItemButton));