DescriptionOption.tsx 840 B

1234567891011121314151617181920212223242526
  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 } = props;
  10. return (
  11. <components.Option {...props}>
  12. <div className="gf-form-select-box__desc-option">
  13. <div className="gf-form-select-box__desc-option__body">
  14. <div>{children}</div>
  15. {data.description && <div className="gf-form-select-box__desc-option__desc">{data.description}</div>}
  16. </div>
  17. {isSelected && <i className="fa fa-check" aria-hidden="true" />}
  18. </div>
  19. </components.Option>
  20. );
  21. };
  22. export default Option;