settingsProjectItem.tsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {useState} from 'react';
  2. import styled from '@emotion/styled';
  3. import ProjectBadge from 'sentry/components/idBadge/projectBadge';
  4. import BookmarkStar from 'sentry/components/projects/bookmarkStar';
  5. import space from 'sentry/styles/space';
  6. import {Organization, Project} from 'sentry/types';
  7. type Props = {
  8. organization: Organization;
  9. project: Project;
  10. };
  11. function ProjectItem({project, organization}: Props) {
  12. const [isBookmarked, setBookmarked] = useState(project.isBookmarked);
  13. return (
  14. <Wrapper>
  15. <BookmarkStar
  16. organization={organization}
  17. project={project}
  18. isBookmarked={isBookmarked}
  19. onToggle={state => setBookmarked(state)}
  20. />
  21. <ProjectBadge
  22. to={`/settings/${organization.slug}/projects/${project.slug}/`}
  23. avatarSize={18}
  24. project={project}
  25. />
  26. </Wrapper>
  27. );
  28. }
  29. const Wrapper = styled('div')`
  30. display: grid;
  31. grid-template-columns: max-content 1fr;
  32. align-items: center;
  33. gap: ${space(1.5)};
  34. `;
  35. export default ProjectItem;