|
@@ -9,7 +9,7 @@ import { useIsNotFound } from '~/stores/page';
|
|
|
|
|
|
|
|
import LinkedPagePath from '../../../models/linked-page-path';
|
|
import LinkedPagePath from '../../../models/linked-page-path';
|
|
|
import { PagePathHierarchicalLink } from '../PagePathHierarchicalLink';
|
|
import { PagePathHierarchicalLink } from '../PagePathHierarchicalLink';
|
|
|
-
|
|
|
|
|
|
|
+import { CollapsedParentsDropdown } from '../PagePathHierarchicalLink/CollapsedParentsDropdown';
|
|
|
|
|
|
|
|
import styles from './PagePathNav.module.scss';
|
|
import styles from './PagePathNav.module.scss';
|
|
|
|
|
|
|
@@ -36,13 +36,21 @@ export const PagePathNav: FC<Props> = (props: Props) => {
|
|
|
const isInTrash = isTrashPage(pagePath);
|
|
const isInTrash = isTrashPage(pagePath);
|
|
|
|
|
|
|
|
let formerLink;
|
|
let formerLink;
|
|
|
|
|
+ let collapsedParent;
|
|
|
let latterLink;
|
|
let latterLink;
|
|
|
|
|
|
|
|
// one line
|
|
// one line
|
|
|
- if (dPagePath.isRoot || dPagePath.isFormerRoot || isSingleLineMode) {
|
|
|
|
|
|
|
+ if (dPagePath.isRoot || dPagePath.isFormerRoot || (!isCollapseParents && isSingleLineMode)) {
|
|
|
const linkedPagePath = new LinkedPagePath(pagePath);
|
|
const linkedPagePath = new LinkedPagePath(pagePath);
|
|
|
latterLink = <PagePathHierarchicalLink linkedPagePath={linkedPagePath} isInTrash={isInTrash} />;
|
|
latterLink = <PagePathHierarchicalLink linkedPagePath={linkedPagePath} isInTrash={isInTrash} />;
|
|
|
}
|
|
}
|
|
|
|
|
+ // collapse parents
|
|
|
|
|
+ else if (isCollapseParents) {
|
|
|
|
|
+ const linkedPagePathFormer = new LinkedPagePath(dPagePath.former);
|
|
|
|
|
+ const linkedPagePathLatter = new LinkedPagePath(dPagePath.latter);
|
|
|
|
|
+ collapsedParent = <CollapsedParentsDropdown linkedPagePath={linkedPagePathFormer} />;
|
|
|
|
|
+ latterLink = <PagePathHierarchicalLink linkedPagePath={linkedPagePathLatter} basePath={dPagePath.former} isInTrash={isInTrash} />;
|
|
|
|
|
+ }
|
|
|
// two line
|
|
// two line
|
|
|
else {
|
|
else {
|
|
|
const linkedPagePathFormer = new LinkedPagePath(dPagePath.former);
|
|
const linkedPagePathFormer = new LinkedPagePath(dPagePath.former);
|
|
@@ -58,7 +66,11 @@ export const PagePathNav: FC<Props> = (props: Props) => {
|
|
|
<div className="grw-page-path-nav">
|
|
<div className="grw-page-path-nav">
|
|
|
{formerLink}
|
|
{formerLink}
|
|
|
<div className="d-flex align-items-center">
|
|
<div className="d-flex align-items-center">
|
|
|
- <h1 className="m-0 text-truncate">{latterLink}</h1>
|
|
|
|
|
|
|
+ <h1 className="m-0 text-truncate">
|
|
|
|
|
+ {collapsedParent}
|
|
|
|
|
+ <span className={styles['grw-mr-02em']}>/</span>
|
|
|
|
|
+ {latterLink}
|
|
|
|
|
+ </h1>
|
|
|
{ pageId != null && !isNotFound && (
|
|
{ pageId != null && !isNotFound && (
|
|
|
<div className="mx-2">
|
|
<div className="mx-2">
|
|
|
<CopyDropdown pageId={pageId} pagePath={pagePath} dropdownToggleId={copyDropdownId} dropdownToggleClassName={copyDropdownToggleClassName}>
|
|
<CopyDropdown pageId={pageId} pagePath={pagePath} dropdownToggleId={copyDropdownId} dropdownToggleClassName={copyDropdownToggleClassName}>
|
|
@@ -76,7 +88,7 @@ type PagePathNavStickyProps = Omit<Props, 'isCollapseParents'>;
|
|
|
|
|
|
|
|
export const PagePathNavSticky = (props: PagePathNavStickyProps): JSX.Element => {
|
|
export const PagePathNavSticky = (props: PagePathNavStickyProps): JSX.Element => {
|
|
|
return (
|
|
return (
|
|
|
- <Sticky className={styles['grw-page-path-nav-sticky']}>
|
|
|
|
|
|
|
+ <Sticky className={`${styles['grw-page-path-nav-sticky']} mb-4`}>
|
|
|
{({ status }: { status: boolean }) => {
|
|
{({ status }: { status: boolean }) => {
|
|
|
const isCollapseParents = status === Sticky.STATUS_FIXED;
|
|
const isCollapseParents = status === Sticky.STATUS_FIXED;
|
|
|
return <PagePathNav {...props} isCollapseParents={isCollapseParents} />;
|
|
return <PagePathNav {...props} isCollapseParents={isCollapseParents} />;
|