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 885B

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