mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
29 lines
775 B
TypeScript
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;
|