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.

CustomOptionButton.tsx 805B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from 'react';
  2. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  3. interface IProps extends AbstractButtonProps {
  4. icon: string;
  5. id?: string;
  6. text: string;
  7. }
  8. /**
  9. * Component that renders a custom toolbox button.
  10. *
  11. * @returns {Component}
  12. */
  13. class CustomOptionButton extends AbstractButton<IProps> {
  14. iconSrc = this.props.icon;
  15. id = this.props.id;
  16. text = this.props.text;
  17. accessibilityLabel = this.text;
  18. /**
  19. * Custom icon component.
  20. *
  21. * @param {any} props - Icon's props.
  22. * @returns {img}
  23. */
  24. icon = (props: any) => (<img
  25. src = { this.iconSrc }
  26. { ...props } />);
  27. label = this.text;
  28. tooltip = this.text;
  29. }
  30. export default CustomOptionButton;