createProjectButton.tsx 821 B

12345678910111213141516171819202122232425262728
  1. import {Button} from 'sentry/components/button';
  2. import {useProjectCreationAccess} from 'sentry/components/projects/useProjectCreationAccess';
  3. import {IconAdd} from 'sentry/icons';
  4. import {t} from 'sentry/locale';
  5. import {Organization} from 'sentry/types';
  6. type Props = {
  7. organization: Organization;
  8. };
  9. export default function CreateProjectButton({organization}: Props) {
  10. const {canCreateProject} = useProjectCreationAccess(organization);
  11. return (
  12. <Button
  13. priority="primary"
  14. size="sm"
  15. disabled={!canCreateProject}
  16. title={
  17. !canCreateProject ? t('You do not have permission to create projects') : undefined
  18. }
  19. to={`/organizations/${organization.slug}/projects/new/`}
  20. icon={<IconAdd size="xs" isCircled />}
  21. >
  22. {t('Create Project')}
  23. </Button>
  24. );
  25. }