search.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import {browserHistory} from 'react-router';
  2. import styled from '@emotion/styled';
  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. display: grid;
  35. width: 100%;
  36. `;