Sfoglia il codice sorgente

modify path name and prefix

yuto-o 4 anni fa
parent
commit
71e06a75ed

+ 8 - 0
packages/app/src/client/util/search/path.ts

@@ -0,0 +1,8 @@
+interface SpecificPathNames {
+  [pathName: string]: string;
+}
+
+export const specificPathNames: SpecificPathNames = {
+  user: 'user',
+  trash: 'trash',
+};

+ 10 - 7
packages/app/src/components/SearchPage.jsx

@@ -12,7 +12,7 @@ import SearchPageLayout from './SearchPage/SearchPageLayout';
 import SearchResultContent from './SearchPage/SearchResultContent';
 import SearchResultList from './SearchPage/SearchResultList';
 import SearchControl from './SearchPage/SearchControl';
-import { specificPath } from '../client/util/search/specificPath';
+import { specificPathNames } from '../client/util/search/path';
 
 class SearchPage extends React.Component {
 
@@ -60,10 +60,10 @@ class SearchPage extends React.Component {
 
   toggleIncludedSpecificPath(pathType) {
     switch (pathType) {
-      case specificPath.user:
+      case specificPathNames.user:
         this.setState({ isNotIncludeUserPath: !this.state.isNotIncludeUserPath });
         break;
-      case specificPath.trash:
+      case specificPathNames.trash:
         this.setState({ isNotIncludeTrashPath: !this.state.isNotIncludeTrashPath });
         break;
     }
@@ -84,11 +84,14 @@ class SearchPage extends React.Component {
     let query = keyword;
 
     // pages included in specific path are not retrived when prefix is added
-    if (this.state.isNotIncludeTrashPath) {
-      query = `${query} -prefix:/${specificPath.trash}`;
+    if (this.state.isNotIncludeTrashPath && this.state.isNotIncludeUserPath) {
+      query = `${query} -prefix:/${specificPathNames.trash}/${specificPathNames.user}`;
     }
-    if (this.state.isNotIncludeUserPath) {
-      query = `${query} -prefix:/${specificPath.user}`;
+    else if (this.state.isNotIncludeTrashPath) {
+      query = `${query} -prefix:/${specificPathNames.trash}`;
+    }
+    else if (this.state.isNotIncludeUserPath) {
+      query = `${query} -prefix:/${specificPathNames.user}`;
     }
 
     return query;

+ 3 - 3
packages/app/src/components/SearchPage/SearchControl.tsx

@@ -1,6 +1,6 @@
 import React, { FC } from 'react';
 import SearchPageForm from './SearchPageForm';
-import { specificPath } from '../../client/util/search/specificPath';
+import { specificPathNames } from '../../client/util/search/path';
 import AppContainer from '../../client/services/AppContainer';
 
 
@@ -32,7 +32,7 @@ const SearchControl: FC <Props> = (props: Props) => {
             type="checkbox"
             value=""
             id="flexCheckDefault"
-            onClick={() => props.toggleIncludedSpecificPath(specificPath.user)}
+            onClick={() => props.toggleIncludedSpecificPath(specificPathNames.user)}
           />
           <label className="form-check-label" htmlFor="flexCheckDefault">
             /user下を含む
@@ -44,7 +44,7 @@ const SearchControl: FC <Props> = (props: Props) => {
             type="checkbox"
             value=""
             id="flexCheckChecked"
-            onClick={() => props.toggleIncludedSpecificPath(specificPath.trash)}
+            onClick={() => props.toggleIncludedSpecificPath(specificPathNames.trash)}
           />
           <label className="form-check-label" htmlFor="flexCheckChecked">
             /trash下を含む

+ 1 - 1
packages/app/src/components/SearchPage/SearchPageForm.jsx

@@ -40,7 +40,7 @@ class SearchPageForm extends React.Component {
 
   render() {
     return (
-      // TODO: modify design
+      // TODO: modify design after other component created
       <div className="grw-search-form-in-search-result-page d-flex">
         <div className="input-group flex-nowrap">
           <SearchForm

+ 0 - 32
packages/app/src/styles/_search.scss

@@ -116,38 +116,6 @@
   }
 }
 
-// searchbox in the search result page
-.grw-search-form-in-search-result-page {
-  $search-box-border-radius: 40px;
-
-  .rbt-input-main {
-    padding-right: 58px;
-    padding-left: 26px;
-    // to display corner radius
-    border-top-left-radius: $search-box-border-radius;
-    border-bottom-left-radius: $search-box-border-radius;
-  }
-
-  .input-group {
-    border: solid 1px $gray-300;
-    border-radius: $search-box-border-radius;
-  }
-
-  .form-control {
-    border: none;
-    &:focus {
-      // to overwrite default css
-      box-shadow: none !important;
-    }
-  }
-
-  #button-addon2 {
-    // to display corner radius
-    border-top-right-radius: $search-box-border-radius;
-    border-bottom-right-radius: $search-box-border-radius;
-  }
-}
-
 // layout
 .grw-global-search-top {
   // centering on navbar