| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import React, { FC } from 'react';
- import { useTranslation } from 'react-i18next';
- import SearchPageForm from './SearchPageForm';
- import AppContainer from '../../client/services/AppContainer';
- import DeleteSelectedPageGroup from './DeleteSelectedPageGroup';
- import { CheckboxType } from '../../interfaces/search';
- import loggerFactory from '~/utils/logger';
- const logger = loggerFactory('growi:searchResultList');
- type Props = {
- searchingKeyword: string,
- checkboxState: CheckboxType,
- appContainer: AppContainer,
- onSearchInvoked: (data : any[]) => boolean,
- onExcludeUsersHome?: () => void,
- onExcludeTrash?: () => void,
- onClickInvoked?: () => void,
- }
- const SearchControl: FC <Props> = (props: Props) => {
- // Temporaly workaround for lint error
- // later needs to be fixed: SearchControl to typescript componet
- const SearchPageFormTypeAny : any = SearchPageForm;
- const { t } = useTranslation('');
- const onExcludeUsersHome = () => {
- if (props.onExcludeUsersHome != null) {
- props.onExcludeUsersHome();
- }
- };
- const onExcludeTrash = () => {
- if (props.onExcludeTrash != null) {
- props.onExcludeTrash();
- }
- };
- const onDeleteSelectedPageHandler = () => {
- console.log('onDeleteSelectedPageHandler is called');
- // TODO: implement this function to delete selected pages.
- // https://estoc.weseek.co.jp/redmine/issues/77525
- };
- return (
- <div className="">
- <div className="search-page-input sps sps--abv">
- <SearchPageFormTypeAny
- keyword={props.searchingKeyword}
- appContainer={props.appContainer}
- onSearchFormChanged={props.onSearchInvoked}
- />
- </div>
- {/* TODO: replace the following elements deleteAll button , relevance button and include specificPath button component */}
- <div className="d-flex my-4">
- {/* Todo: design will be fixed in #80324. Function will be implemented in #77525 */}
- <DeleteSelectedPageGroup
- checkboxState={props.checkboxState}
- onClickInvoked={onDeleteSelectedPageHandler}
- onCheckInvoked={props.onClickInvoked}
- />
- <div className="d-flex align-items-center border rounded border-gray px-2 py-1 mr-2 ml-auto">
- <label className="my-0 mr-2" htmlFor="flexCheckDefault">
- {t('Include Subordinated Target Page', { target: '/user' })}
- </label>
- <input
- type="checkbox"
- id="flexCheckDefault"
- onClick={() => onExcludeUsersHome()}
- />
- </div>
- <div className="d-flex align-items-center border rounded border-gray px-2 mr-3">
- <label className="my-0 mr-2" htmlFor="flexCheckChecked">
- {t('Include Subordinated Target Page', { target: '/trash' })}
- </label>
- <input
- type="checkbox"
- id="flexCheckChecked"
- onClick={() => onExcludeTrash()}
- />
- </div>
- </div>
- </div>
- );
- };
- export default SearchControl;
|