groupListHeader.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import styled from '@emotion/styled';
  2. import PanelHeader from 'sentry/components/panels/panelHeader';
  3. import {t} from 'sentry/locale';
  4. import {space} from 'sentry/styles/space';
  5. import type {GroupListColumn} from './groupList';
  6. type Props = {
  7. withChart: boolean;
  8. narrowGroups?: boolean;
  9. withColumns?: GroupListColumn[];
  10. };
  11. function GroupListHeader({
  12. withChart = true,
  13. narrowGroups = false,
  14. withColumns = ['graph', 'event', 'users', 'assignee', 'lastTriggered'],
  15. }: Props) {
  16. return (
  17. <PanelHeader disablePadding>
  18. <IssueWrapper>{t('Issue')}</IssueWrapper>
  19. {withChart && withColumns.includes('graph') && (
  20. <ChartWrapper narrowGroups={narrowGroups}>{t('Graph')}</ChartWrapper>
  21. )}
  22. {withColumns.includes('event') && (
  23. <EventUserWrapper>{t('events')}</EventUserWrapper>
  24. )}
  25. {withColumns.includes('users') && <EventUserWrapper>{t('users')}</EventUserWrapper>}
  26. {withColumns.includes('priority') && (
  27. <PriorityWrapper narrowGroups={narrowGroups}>{t('Priority')}</PriorityWrapper>
  28. )}
  29. {withColumns.includes('assignee') && (
  30. <AssigneeWrapper narrowGroups={narrowGroups}>{t('Assignee')}</AssigneeWrapper>
  31. )}
  32. {withColumns.includes('lastTriggered') && (
  33. <EventUserWrapper>{t('Last Triggered')}</EventUserWrapper>
  34. )}
  35. </PanelHeader>
  36. );
  37. }
  38. export default GroupListHeader;
  39. const Heading = styled('div')`
  40. display: flex;
  41. align-self: center;
  42. margin: 0 ${space(2)};
  43. color: ${p => p.theme.subText};
  44. `;
  45. const IssueWrapper = styled(Heading)`
  46. flex: 1;
  47. width: 66.66%;
  48. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  49. width: 50%;
  50. }
  51. `;
  52. const EventUserWrapper = styled(Heading)`
  53. justify-content: flex-end;
  54. width: 60px;
  55. white-space: nowrap;
  56. @media (min-width: ${p => p.theme.breakpoints.xlarge}) {
  57. width: 80px;
  58. }
  59. `;
  60. const ChartWrapper = styled(Heading)<{narrowGroups: boolean}>`
  61. justify-content: space-between;
  62. width: 160px;
  63. @media (max-width: ${p =>
  64. p.narrowGroups ? p.theme.breakpoints.xxlarge : p.theme.breakpoints.xlarge}) {
  65. display: none;
  66. }
  67. `;
  68. const PriorityWrapper = styled(Heading)<{narrowGroups: boolean}>`
  69. justify-content: flex-end;
  70. width: 70px;
  71. @media (max-width: ${p =>
  72. p.narrowGroups ? p.theme.breakpoints.large : p.theme.breakpoints.medium}) {
  73. display: none;
  74. }
  75. `;
  76. const AssigneeWrapper = styled(Heading)<{narrowGroups: boolean}>`
  77. justify-content: flex-end;
  78. width: 60px;
  79. @media (max-width: ${p =>
  80. p.narrowGroups ? p.theme.breakpoints.large : p.theme.breakpoints.medium}) {
  81. display: none;
  82. }
  83. `;