DescriptionOption.tsx 834 B

12345678910111213141516171819202122232425
  1. import React from 'react';
  2. import { components } from 'react-select';
  3. import { OptionProps } from 'react-select/lib/components/Option';
  4. // https://github.com/JedWatson/react-select/issues/3038
  5. interface ExtendedOptionProps extends OptionProps<any> {
  6. data: any;
  7. }
  8. export const Option = (props: ExtendedOptionProps) => {
  9. const { children, isSelected, data, className } = props;
  10. return (
  11. <components.Option {...props}>
  12. <div className={`description-picker-option__button btn btn-link ${className}`}>
  13. {isSelected && <i className="fa fa-check pull-right" aria-hidden="true" />}
  14. <div className="gf-form">{children}</div>
  15. <div className="gf-form">
  16. <div className="muted width-17">{data.description}</div>
  17. </div>
  18. </div>
  19. </components.Option>
  20. );
  21. };
  22. export default Option;