|
|
@@ -1,18 +1,11 @@
|
|
|
import React from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
-import { withTranslation } from 'react-i18next';
|
|
|
-
|
|
|
-import { DevidedPagePath } from '@growi/core';
|
|
|
-import PagePathHierarchicalLink from '~/components/PagePathHierarchicalLink';
|
|
|
-import LinkedPagePath from '~/models/linked-page-path';
|
|
|
-
|
|
|
import { withUnstatedContainers } from '../UnstatedUtils';
|
|
|
import AppContainer from '~/client/services/AppContainer';
|
|
|
import NavigationContainer from '~/client/services/NavigationContainer';
|
|
|
import PageContainer from '~/client/services/PageContainer';
|
|
|
|
|
|
-import CopyDropdown from '../Page/CopyDropdown';
|
|
|
import TagLabels from '../Page/TagLabels';
|
|
|
import SubnavButtons from './SubNavButtons';
|
|
|
import PageEditorModeManager from './PageEditorModeManager';
|
|
|
@@ -20,51 +13,7 @@ import PageEditorModeManager from './PageEditorModeManager';
|
|
|
import AuthorInfo from './AuthorInfo';
|
|
|
import DrawerToggler from './DrawerToggler';
|
|
|
|
|
|
-const PagePathNav = ({
|
|
|
- // eslint-disable-next-line react/prop-types
|
|
|
- pageId, pagePath, isEditorMode, isCompactMode,
|
|
|
-}) => {
|
|
|
-
|
|
|
- const dPagePath = new DevidedPagePath(pagePath, false, true);
|
|
|
-
|
|
|
- let formerLink;
|
|
|
- let latterLink;
|
|
|
-
|
|
|
- // one line
|
|
|
- if (dPagePath.isRoot || dPagePath.isFormerRoot || isEditorMode) {
|
|
|
- const linkedPagePath = new LinkedPagePath(pagePath);
|
|
|
- latterLink = <PagePathHierarchicalLink linkedPagePath={linkedPagePath} />;
|
|
|
- }
|
|
|
- // two line
|
|
|
- else {
|
|
|
- const linkedPagePathFormer = new LinkedPagePath(dPagePath.former);
|
|
|
- const linkedPagePathLatter = new LinkedPagePath(dPagePath.latter);
|
|
|
- formerLink = <PagePathHierarchicalLink linkedPagePath={linkedPagePathFormer} />;
|
|
|
- latterLink = <PagePathHierarchicalLink linkedPagePath={linkedPagePathLatter} basePath={dPagePath.former} />;
|
|
|
- }
|
|
|
-
|
|
|
- const copyDropdownId = `copydropdown${isCompactMode ? '-subnav-compact' : ''}-${pageId}`;
|
|
|
- const copyDropdownToggleClassName = 'd-block text-muted bg-transparent btn-copy border-0 py-0';
|
|
|
-
|
|
|
- return (
|
|
|
- <div className="grw-page-path-nav">
|
|
|
- {formerLink}
|
|
|
- <span className="d-flex align-items-center">
|
|
|
- <h1 className="m-0">{latterLink}</h1>
|
|
|
- <div className="mx-2">
|
|
|
- <CopyDropdown
|
|
|
- pageId={pageId}
|
|
|
- pagePath={pagePath}
|
|
|
- dropdownToggleId={copyDropdownId}
|
|
|
- dropdownToggleClassName={copyDropdownToggleClassName}
|
|
|
- >
|
|
|
- <i className="ti-clipboard"></i>
|
|
|
- </CopyDropdown>
|
|
|
- </div>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- );
|
|
|
-};
|
|
|
+import PagePathNav from '../PagePathNav';
|
|
|
|
|
|
const GrowiSubNavigation = (props) => {
|
|
|
const {
|
|
|
@@ -101,7 +50,7 @@ const GrowiSubNavigation = (props) => {
|
|
|
<TagLabels editorMode={editorMode} />
|
|
|
</div>
|
|
|
) }
|
|
|
- <PagePathNav pageId={pageId} pagePath={path} isEditorMode={isEditorMode} isCompactMode={isCompactMode} />
|
|
|
+ <PagePathNav pageId={pageId} pagePath={path} isSingleLineMode={isEditorMode} isCompactMode={isCompactMode} />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -136,10 +85,8 @@ const GrowiSubNavigation = (props) => {
|
|
|
</ul>
|
|
|
) }
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
);
|
|
|
-
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -149,7 +96,6 @@ const GrowiSubNavigationWrapper = withUnstatedContainers(GrowiSubNavigation, [Ap
|
|
|
|
|
|
|
|
|
GrowiSubNavigation.propTypes = {
|
|
|
- t: PropTypes.func.isRequired, // i18next
|
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
navigationContainer: PropTypes.instanceOf(NavigationContainer).isRequired,
|
|
|
pageContainer: PropTypes.instanceOf(PageContainer).isRequired,
|
|
|
@@ -157,4 +103,4 @@ GrowiSubNavigation.propTypes = {
|
|
|
isCompactMode: PropTypes.bool,
|
|
|
};
|
|
|
|
|
|
-export default withTranslation()(GrowiSubNavigationWrapper);
|
|
|
+export default GrowiSubNavigationWrapper;
|