filters.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import styled from '@emotion/styled';
  2. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  3. import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
  4. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  5. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  6. import {space} from 'sentry/styles/space';
  7. import {IssueSearchWithSavedSearches} from 'sentry/views/issueList/issueSearchWithSavedSearches';
  8. interface Props {
  9. onSearch: (query: string) => void;
  10. query: string;
  11. }
  12. function IssueListFilters({query, onSearch}: Props) {
  13. return (
  14. <SearchContainer>
  15. <StyledPageFilterBar>
  16. <ProjectPageFilter />
  17. <EnvironmentPageFilter />
  18. <DatePageFilter />
  19. </StyledPageFilterBar>
  20. <IssueSearchWithSavedSearches {...{query, onSearch}} />
  21. </SearchContainer>
  22. );
  23. }
  24. const SearchContainer = styled('div')`
  25. display: flex;
  26. flex-wrap: wrap;
  27. column-gap: ${space(2)};
  28. row-gap: ${space(1)};
  29. width: 100%;
  30. margin-bottom: ${space(2)};
  31. @media (max-width: ${p => p.theme.breakpoints.small}) {
  32. flex-direction: column;
  33. }
  34. `;
  35. const StyledPageFilterBar = styled(PageFilterBar)`
  36. display: flex;
  37. flex-basis: content;
  38. width: 100%;
  39. max-width: 43rem;
  40. align-self: flex-start;
  41. > div > button {
  42. width: 100%;
  43. }
  44. & > * {
  45. /* Prevent date filter from shrinking below 6.5rem */
  46. &:nth-last-child(2) {
  47. min-width: 6.5rem;
  48. }
  49. &:last-child {
  50. min-width: 0;
  51. }
  52. }
  53. `;
  54. export default IssueListFilters;