search.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import styled from '@emotion/styled';
  2. import {browserHistory} from 'sentry/utils/browserHistory';
  3. import {decodeScalar} from 'sentry/utils/queryString';
  4. import {useLocation} from 'sentry/utils/useLocation';
  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. return (
  13. <SearchContainer>
  14. <ReplaySearchBar
  15. organization={organization}
  16. pageFilters={selection}
  17. defaultQuery=""
  18. query={decodeScalar(query.query, '')}
  19. onSearch={searchQuery => {
  20. browserHistory.push({
  21. pathname,
  22. query: {
  23. ...query,
  24. cursor: undefined,
  25. query: searchQuery.trim(),
  26. },
  27. });
  28. }}
  29. />
  30. </SearchContainer>
  31. );
  32. }
  33. const SearchContainer = styled('div')`
  34. flex-grow: 1;
  35. min-width: 400px;
  36. @media (max-width: ${p => p.theme.breakpoints.small}) {
  37. min-width: auto;
  38. }
  39. `;