Taichi Masuyama 3 лет назад
Родитель
Сommit
7c1afa2c97

+ 14 - 8
packages/app/src/pages/_search.page.tsx

@@ -26,6 +26,7 @@ import { SearchPage } from '../components/SearchPage';
 import {
   CommonProps, getNextI18NextConfig, getServerSideCommonProps, generateCustomTitle,
 } from './utils/commons';
+import { NextPageWithLayout } from './_app.page';
 
 const SearchResultLayout = dynamic(() => import('~/components/Layout/SearchResultLayout'), { ssr: false });
 
@@ -53,7 +54,7 @@ type Props = CommonProps & {
 
 };
 
-const SearchResultPage: NextPage<Props> = (props: Props) => {
+const SearchResultPage: NextPageWithLayout<Props> = (props: Props) => {
   const { userUISettings } = props;
 
   // commons
@@ -95,19 +96,24 @@ const SearchResultPage: NextPage<Props> = (props: Props) => {
         <title>{title}</title>
       </Head>
 
-      <DrawioViewerScript />
-
-      <SearchResultLayout>
-        <div id="search-page">
-          <SearchPage />
-        </div>
-      </SearchResultLayout>
+      <div id="search-page" className="dynamic-layout-root">
+        <SearchPage />
+      </div>
 
       <PutbackPageModal />
     </>
   );
 };
 
+SearchResultPage.getLayout = function getLayout(page) {
+  return (
+    <>
+      <DrawioViewerScript />
+      <SearchResultLayout>{page}</SearchResultLayout>
+    </>
+  );
+};
+
 async function injectUserUISettings(context: GetServerSidePropsContext, props: Props): Promise<void> {
   const { model: mongooseModel } = await import('mongoose');
 

+ 22 - 14
packages/app/src/pages/me/[[...path]].page.tsx

@@ -31,6 +31,7 @@ import loggerFactory from '~/utils/logger';
 import {
   CommonProps, getNextI18NextConfig, getServerSideCommonProps, generateCustomTitle,
 } from '../utils/commons';
+import { NextPageWithLayout } from '../_app.page';
 
 
 const logger = loggerFactory('growi:pages:me');
@@ -54,7 +55,7 @@ const InAppNotificationPage = dynamic(
   () => import('~/components/InAppNotification/InAppNotificationPage').then(mod => mod.InAppNotificationPage), { ssr: false },
 );
 
-const MePage: NextPage<Props> = (props: Props) => {
+const MePage: NextPageWithLayout<Props> = (props: Props) => {
   const router = useRouter();
   const { t } = useTranslation(['translation', 'commons']);
   const { path } = router.query;
@@ -113,25 +114,32 @@ const MePage: NextPage<Props> = (props: Props) => {
   const title = generateCustomTitle(props, 'GROWI');
 
   return (
-    <BasicLayout>
+    <>
       <Head>
         <title>{title}</title>
       </Head>
-      <header className="py-3">
-        <div className="container-fluid">
-          <h1 className="title">{ targetPage.title }</h1>
-        </div>
-      </header>
-
-      <div id="grw-fav-sticky-trigger" className="sticky-top"></div>
-
-      <div id="main" className='main'>
-        <div id="content-main" className="content-main grw-container-convertible">
-          {targetPage.component}
+      <div className="dynamic-layout-root">
+        <header className="py-3">
+          <div className="container-fluid">
+            <h1 className="title">{ targetPage.title }</h1>
+          </div>
+        </header>
+
+        <div id="grw-fav-sticky-trigger" className="sticky-top"></div>
+
+        <div id="main" className='main'>
+          <div id="content-main" className="content-main grw-container-convertible">
+            {targetPage.component}
+          </div>
         </div>
       </div>
+    </>
+  );
+};
 
-    </BasicLayout>
+MePage.getLayout = function getLayout(page) {
+  return (
+    <BasicLayout>{page}</BasicLayout>
   );
 };
 

+ 35 - 26
packages/app/src/pages/tags.page.tsx

@@ -28,6 +28,7 @@ import {
 import {
   CommonProps, getServerSideCommonProps, getNextI18NextConfig, generateCustomTitle,
 } from './utils/commons';
+import { NextPageWithLayout } from './_app.page';
 
 const PAGING_LIMIT = 10;
 
@@ -49,7 +50,7 @@ type Props = CommonProps & {
 const TagList = dynamic(() => import('~/components/TagList'), { ssr: false });
 const TagCloudBox = dynamic(() => import('~/components/TagCloudBox'), { ssr: false });
 
-const TagPage: NextPage<CommonProps> = (props: Props) => {
+const TagPage: NextPageWithLayout<CommonProps> = (props: Props) => {
   const [activePage, setActivePage] = useState<number>(1);
   const [offset, setOffset] = useState<number>(0);
 
@@ -82,36 +83,44 @@ const TagPage: NextPage<CommonProps> = (props: Props) => {
   const title = generateCustomTitle(props, 'GROWI');
 
   return (
-    <BasicLayout>
+    <>
       <Head>
         <title>{title}</title>
       </Head>
-      <div className="grw-container-convertible mb-5 pb-5" data-testid="tags-page">
-        <h2 className="my-3">{`${t('Tags')}(${totalCount})`}</h2>
-        <div className="px-3 mb-5 text-center">
-          <TagCloudBox tags={tagData} minSize={20} />
+      <div className="dynamic-layout-root">
+        <div className="grw-container-convertible mb-5 pb-5" data-testid="tags-page">
+          <h2 className="my-3">{`${t('Tags')}(${totalCount})`}</h2>
+          <div className="px-3 mb-5 text-center">
+            <TagCloudBox tags={tagData} minSize={20} />
+          </div>
+          { isLoading
+            ? (
+              <div className="text-muted text-center">
+                <i className="fa fa-2x fa-spinner fa-pulse mt-3"></i>
+              </div>
+            )
+            : (
+              <div data-testid="grw-tags-list">
+                <TagList
+                  tagData={tagData}
+                  totalTags={totalCount}
+                  activePage={activePage}
+                  onChangePage={setOffsetByPageNumber}
+                  pagingLimit={PAGING_LIMIT}
+                />
+              </div>
+            )
+          }
+          <div id="grw-fav-sticky-trigger" className="sticky-top"></div>
         </div>
-        { isLoading
-          ? (
-            <div className="text-muted text-center">
-              <i className="fa fa-2x fa-spinner fa-pulse mt-3"></i>
-            </div>
-          )
-          : (
-            <div data-testid="grw-tags-list">
-              <TagList
-                tagData={tagData}
-                totalTags={totalCount}
-                activePage={activePage}
-                onChangePage={setOffsetByPageNumber}
-                pagingLimit={PAGING_LIMIT}
-              />
-            </div>
-          )
-        }
-        <div id="grw-fav-sticky-trigger" className="sticky-top"></div>
       </div>
-    </BasicLayout>
+    </>
+  );
+};
+
+TagPage.getLayout = function getLayout(page) {
+  return (
+    <BasicLayout>{page}</BasicLayout>
   );
 };