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

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