Files
2024-02-15 17:01:50 +00:00

29 lines
775 B
TypeScript

import type {ButtonProps} from 'sentry/components/button';
import {Button} from 'sentry/components/button';
import DiscoverFeature from 'sentry/components/discover/discoverFeature';
import {t} from 'sentry/locale';
type DiscoverButtonProps = Omit<ButtonProps, 'aria-label'>;
/**
* Provide a button that turns itself off if the current organization
* doesn't have access to discover results.
*/
function DiscoverButton({children, ...buttonProps}: DiscoverButtonProps) {
return (
<DiscoverFeature>
{({hasFeature}) => (
<Button
disabled={!hasFeature}
aria-label={t('Open in Discover')}
{...buttonProps}
>
{children}
</Button>
)}
</DiscoverFeature>
);
}
export default DiscoverButton;