SearchControl.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import React, { FC } from 'react';
  2. import PropTypes from 'prop-types';
  3. import SearchPageForm from './SearchPageForm';
  4. import AppContainer from '../../client/services/AppContainer';
  5. type page = {
  6. status: string,
  7. grant: number,
  8. grantedUsers: string[],
  9. liker: string[],
  10. seenUsers: string[],
  11. commentCount: number,
  12. _id: string,
  13. createdAt: string,
  14. updatedAt: string,
  15. path: string,
  16. creator: string,
  17. lastUpdateUser: {
  18. isGravatarEnabled: boolean,
  19. isEmailPublished: boolean,
  20. lang: string,
  21. status: number,
  22. admin: boolean,
  23. isInvitationEmailSended: boolean,
  24. _id: string,
  25. createdAt: string,
  26. name: string,
  27. username: string,
  28. email: string,
  29. imageUrlCached: string,
  30. lastLoginAt: string,
  31. },
  32. redirecTo: string,
  33. grantedGroup: string[],
  34. _v : string,
  35. revision: string,
  36. id: string
  37. }
  38. type Props = {
  39. searchingKeyword: string,
  40. appContainer: AppContainer,
  41. t: (str: string) => string,
  42. onSearchInvoked: (data : page[]) => boolean,
  43. }
  44. const SearchControl: FC <Props> = (props: Props) => {
  45. // Temporaly workaround for lint error
  46. // later needs to be fixed: SearchControl to typescript componet
  47. const SearchPageFormTypeAny : any = SearchPageForm;
  48. return (
  49. <div className="">
  50. <div className="search-page-input sps sps--abv">
  51. <SearchPageFormTypeAny
  52. t={props.t}
  53. keyword={props.searchingKeyword}
  54. appContainer={props.appContainer}
  55. onSearchFormChanged={props.onSearchInvoked}
  56. />
  57. </div>
  58. {/* TODO: place deleteAll button , relevance button , include specificPath button */}
  59. </div>
  60. );
  61. };
  62. SearchControl.propTypes = {
  63. t: PropTypes.func.isRequired,
  64. searchingKeyword: PropTypes.string.isRequired,
  65. appContainer: PropTypes.instanceOf(AppContainer).isRequired,
  66. onSearchInvoked: PropTypes.func.isRequired,
  67. };
  68. export default SearchControl;