discoverButton.tsx 669 B

123456789101112131415161718192021222324
  1. import type {LinkButtonProps} from 'sentry/components/button';
  2. import {LinkButton} from 'sentry/components/button';
  3. import DiscoverFeature from 'sentry/components/discover/discoverFeature';
  4. import {t} from 'sentry/locale';
  5. /**
  6. * Provide a button that turns itself off if the current organization
  7. * doesn't have access to discover results.
  8. */
  9. function DiscoverButton(buttonProps: LinkButtonProps) {
  10. return (
  11. <DiscoverFeature>
  12. {({hasFeature}) => (
  13. <LinkButton
  14. disabled={!hasFeature}
  15. aria-label={t('Open in Discover')}
  16. {...buttonProps}
  17. />
  18. )}
  19. </DiscoverFeature>
  20. );
  21. }
  22. export default DiscoverButton;