Просмотр исходного кода

add dynamic-layout-root class & apply container fluid to tags and trash

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

+ 2 - 2
packages/app/src/pages/[[...path]].page.tsx

@@ -305,7 +305,7 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
       <Head>
         <title>{title}</title>
       </Head>
-      <div className="h-100 d-flex flex-column justify-content-between">
+      <div className={`dynamic-layout-root ${growiLayoutFluidClass} h-100 d-flex flex-column justify-content-between`}>
         <header className="py-0 position-relative">
           <div id="grw-subnav-container">
             <GrowiContextualSubNavigation isLinkSharingDisabled={props.disableLinkSharing} />
@@ -320,7 +320,7 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
 
         <div className="flex-grow-1">
           <div id="main" className={`main ${isUsersHomePage(props.currentPathname) && 'user-page'}`}>
-            <div id="content-main" className={`content-main grw-container-convertible ${growiLayoutFluidClass}`}>
+            <div id="content-main" className="content-main grw-container-convertible">
               { props.isIdenticalPathPage && <IdenticalPathPage /> }
 
               { !props.isIdenticalPathPage && (

+ 65 - 64
packages/app/src/pages/share/[[...path]].page.tsx

@@ -9,6 +9,7 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
 import dynamic from 'next/dynamic';
 import Head from 'next/head';
 
+import { useCurrentGrowiLayoutFluidClassName } from '~/client/services/layout';
 import CountBadge from '~/components/Common/CountBadge';
 import PageListIcon from '~/components/Icons/PageListIcon';
 import { ShareLinkLayout } from '~/components/Layout/ShareLinkLayout';
@@ -64,6 +65,8 @@ const SharedPage: NextPage<Props> = (props: Props) => {
   const { open: openDescendantPageListModal } = useDescendantsPageListModal();
   const { t } = useTranslation();
 
+  const growiLayoutFluidClass = useCurrentGrowiLayoutFluidClassName();
+
   const isNotFound = props.shareLink == null || props.shareLink.relatedPage == null || props.shareLink.relatedPage.isEmpty;
   const isShowSharedPage = !props.disableLinkSharing && !isNotFound && !props.isExpired;
   const shareLink = props.shareLink;
@@ -79,7 +82,7 @@ const SharedPage: NextPage<Props> = (props: Props) => {
       <DrawioViewerScript />
 
       <ShareLinkLayout>
-        <div className="h-100 d-flex flex-column justify-content-between">
+        <div className={`dynamic-layout-root ${growiLayoutFluidClass} h-100 d-flex flex-column justify-content-between`}>
           <header className="py-0 position-relative">
             {isShowSharedPage && <GrowiContextualSubNavigation isLinkSharingDisabled={props.disableLinkSharing} />}
           </header>
@@ -87,73 +90,71 @@ const SharedPage: NextPage<Props> = (props: Props) => {
           <div id="grw-fav-sticky-trigger" className="sticky-top"></div>
 
           <div className="flex-grow-1">
-            <div id="content-main" className="content-main">
-              <div className="grw-container-convertible">
-                { props.disableLinkSharing && (
-                  <div className="mt-4">
-                    <ForbiddenPage isLinkSharingDisabled={props.disableLinkSharing} />
-                  </div>
-                )}
-
-                { (isNotFound && !props.disableLinkSharing) && (
-                  <div className="container-lg">
-                    <h2 className="text-muted mt-4">
-                      <i className="icon-ban" aria-hidden="true" />
-                      <span> Page is not found</span>
-                    </h2>
-                  </div>
-                )}
-
-                { (props.isExpired && !props.disableLinkSharing && shareLink != null) && (
-                  <div className="container-lg">
-                    <ShareLinkAlert expiredAt={shareLink.expiredAt} createdAt={shareLink.createdAt} />
-                    <h2 className="text-muted mt-4">
-                      <i className="icon-ban" aria-hidden="true" />
-                      <span> Page is expired</span>
-                    </h2>
-                  </div>
-                )}
-
-                {(isShowSharedPage && shareLink != null) && (
-                  <>
-                    <ShareLinkAlert expiredAt={shareLink.expiredAt} createdAt={shareLink.createdAt} />
-                    <div className="d-flex flex-column flex-lg-row-reverse">
-
-                      <div className="grw-side-contents-container">
-                        <div className="grw-side-contents-sticky-container">
-
-                          {/* Page list */}
-                          <div className={`grw-page-accessories-control ${styles['grw-page-accessories-control']}`}>
-                            { shareLink.relatedPage.path != null && (
-                              <button
-                                type="button"
-                                className="btn btn-block btn-outline-secondary grw-btn-page-accessories
-                                rounded-pill d-flex justify-content-between align-items-center"
-                                onClick={() => openDescendantPageListModal(shareLink.relatedPage.path)}
-                                data-testid="pageListButton"
-                              >
-                                <div className="grw-page-accessories-control-icon">
-                                  <PageListIcon />
-                                </div>
-                                {t('page_list')}
-                                <CountBadge count={shareLink.relatedPage.descendantCount} offset={1} />
-                              </button>
-                            ) }
-                          </div>
-
-                          <div className="d-none d-lg-block">
-                            <TableOfContents />
-                          </div>
+            <div id="content-main" className="content-main grw-container-convertible">
+              { props.disableLinkSharing && (
+                <div className="mt-4">
+                  <ForbiddenPage isLinkSharingDisabled={props.disableLinkSharing} />
+                </div>
+              )}
+
+              { (isNotFound && !props.disableLinkSharing) && (
+                <div className="container-lg">
+                  <h2 className="text-muted mt-4">
+                    <i className="icon-ban" aria-hidden="true" />
+                    <span> Page is not found</span>
+                  </h2>
+                </div>
+              )}
+
+              { (props.isExpired && !props.disableLinkSharing && shareLink != null) && (
+                <div className="container-lg">
+                  <ShareLinkAlert expiredAt={shareLink.expiredAt} createdAt={shareLink.createdAt} />
+                  <h2 className="text-muted mt-4">
+                    <i className="icon-ban" aria-hidden="true" />
+                    <span> Page is expired</span>
+                  </h2>
+                </div>
+              )}
+
+              {(isShowSharedPage && shareLink != null) && (
+                <>
+                  <ShareLinkAlert expiredAt={shareLink.expiredAt} createdAt={shareLink.createdAt} />
+                  <div className="d-flex flex-column flex-lg-row-reverse">
+
+                    <div className="grw-side-contents-container">
+                      <div className="grw-side-contents-sticky-container">
+
+                        {/* Page list */}
+                        <div className={`grw-page-accessories-control ${styles['grw-page-accessories-control']}`}>
+                          { shareLink.relatedPage.path != null && (
+                            <button
+                              type="button"
+                              className="btn btn-block btn-outline-secondary grw-btn-page-accessories
+                              rounded-pill d-flex justify-content-between align-items-center"
+                              onClick={() => openDescendantPageListModal(shareLink.relatedPage.path)}
+                              data-testid="pageListButton"
+                            >
+                              <div className="grw-page-accessories-control-icon">
+                                <PageListIcon />
+                              </div>
+                              {t('page_list')}
+                              <CountBadge count={shareLink.relatedPage.descendantCount} offset={1} />
+                            </button>
+                          ) }
                         </div>
-                      </div>
 
-                      <div className="flex-grow-1 flex-basis-0 mw-0">
-                        <Page />
+                        <div className="d-none d-lg-block">
+                          <TableOfContents />
+                        </div>
                       </div>
                     </div>
-                  </>
-                )}
-              </div>
+
+                    <div className="flex-grow-1 flex-basis-0 mw-0">
+                      <Page />
+                    </div>
+                  </div>
+                </>
+              )}
             </div>
           </div>
         </div>

+ 19 - 14
packages/app/src/pages/trash.page.tsx

@@ -6,6 +6,7 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
 import dynamic from 'next/dynamic';
 import Head from 'next/head';
 
+import { useCurrentGrowiLayoutFluidClassName } from '~/client/services/layout';
 import { GrowiSubNavigation } from '~/components/Navbar/GrowiSubNavigation';
 import type { CrowiRequest } from '~/interfaces/crowi-request';
 import type { RendererConfig } from '~/interfaces/services/renderer';
@@ -71,6 +72,8 @@ const TrashPage: NextPage<CommonProps> = (props: Props) => {
   const { data: isDrawerMode } = useDrawerMode();
   const { data: isGuestUser } = useIsGuestUser();
 
+  const growiLayoutFluidClass = useCurrentGrowiLayoutFluidClassName();
+
   const title = generateCustomTitle(props, 'GROWI');
 
   return (
@@ -79,21 +82,23 @@ const TrashPage: NextPage<CommonProps> = (props: Props) => {
         <title>{title}</title>
       </Head>
       <BasicLayoutWithEditorMode>
-        <header className="py-0 position-relative">
-          <GrowiSubNavigation
-            pagePath="/trash"
-            showDrawerToggler={isDrawerMode}
-            isGuestUser={isGuestUser}
-            isDrawerMode={isDrawerMode}
-            additionalClasses={['container-fluid']}
-          />
-        </header>
-
-        <div className="grw-container-convertible mb-5 pb-5">
-          <TrashPageList />
+        <div className={`dynamic-layout-root ${growiLayoutFluidClass}`}>
+          <header className="py-0 position-relative">
+            <GrowiSubNavigation
+              pagePath="/trash"
+              showDrawerToggler={isDrawerMode}
+              isGuestUser={isGuestUser}
+              isDrawerMode={isDrawerMode}
+              additionalClasses={['container-fluid']}
+            />
+          </header>
+
+          <div className="content-main grw-container-convertible mb-5 pb-5">
+            <TrashPageList />
+          </div>
+
+          <div id="grw-fav-sticky-trigger" className="sticky-top"></div>
         </div>
-
-        <div id="grw-fav-sticky-trigger" className="sticky-top"></div>
       </BasicLayoutWithEditorMode>
 
       <EmptyTrashModal />

+ 2 - 2
packages/app/src/styles/_layout.scss

@@ -6,11 +6,11 @@ body {
   overscroll-behavior-y: none;
 }
 
-.content-main:not(.growi-layout-fluid).grw-container-convertible {
+.dynamic-layout-root:not(.growi-layout-fluid) .grw-container-convertible {
   @extend .container-lg;
 }
 
-.content-main.growi-layout-fluid.grw-container-convertible {
+.dynamic-layout-root.growi-layout-fluid .grw-container-convertible {
   @extend .container-fluid;
 }