search.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import styled from '@emotion/styled';
  2. import {decodeScalar} from 'sentry/utils/queryString';
  3. import {useLocation} from 'sentry/utils/useLocation';
  4. import {useNavigate} from 'sentry/utils/useNavigate';
  5. import useOrganization from 'sentry/utils/useOrganization';
  6. import usePageFilters from 'sentry/utils/usePageFilters';
  7. import ReplaySearchBar from 'sentry/views/replays/list/replaySearchBar';
  8. export default function ReplaysSearch() {
  9. const {selection} = usePageFilters();
  10. const {pathname, query} = useLocation();
  11. const organization = useOrganization();
  12. const navigate = useNavigate();
  13. return (
  14. <SearchContainer>
  15. <ReplaySearchBar
  16. organization={organization}
  17. pageFilters={selection}
  18. defaultQuery=""
  19. query={decodeScalar(query.query, '')}
  20. onSearch={searchQuery => {
  21. navigate({
  22. pathname,
  23. query: {
  24. ...query,
  25. cursor: undefined,
  26. query: searchQuery.trim(),
  27. },
  28. });
  29. }}
  30. />
  31. </SearchContainer>
  32. );
  33. }
  34. const SearchContainer = styled('div')`
  35. flex-grow: 1;
  36. min-width: 400px;
  37. @media (max-width: ${p => p.theme.breakpoints.small}) {
  38. min-width: auto;
  39. }
  40. `;