|
|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useCallback, useMemo } from 'react';
|
|
|
+import React, { memo, useCallback, useMemo } from 'react';
|
|
|
|
|
|
import type {
|
|
|
IPageInfoForOperation, IPageToDeleteWithMeta, IPageToRenameWithMeta,
|
|
|
@@ -29,7 +29,7 @@ import SeenUserInfo from './SeenUserInfo';
|
|
|
import SubscribeButton from './SubscribeButton';
|
|
|
|
|
|
|
|
|
-import styles from './SubNavButtons.module.scss';
|
|
|
+import styles from './PageControls.module.scss';
|
|
|
|
|
|
|
|
|
type WideViewMenuItemProps = AdditionalMenuItemsRendererProps & {
|
|
|
@@ -77,7 +77,7 @@ type CommonProps = {
|
|
|
onClickSwitchContentWidth?: (pageId: string, value: boolean) => void,
|
|
|
}
|
|
|
|
|
|
-type SubNavButtonsSubstanceProps = CommonProps & {
|
|
|
+type PageControlsSubstanceProps = CommonProps & {
|
|
|
pageId: string,
|
|
|
shareLinkId?: string | null,
|
|
|
revisionId: string | null,
|
|
|
@@ -86,7 +86,7 @@ type SubNavButtonsSubstanceProps = CommonProps & {
|
|
|
expandContentWidth?: boolean,
|
|
|
}
|
|
|
|
|
|
-const SubNavButtonsSubstance = (props: SubNavButtonsSubstanceProps): JSX.Element => {
|
|
|
+const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element => {
|
|
|
const {
|
|
|
pageInfo,
|
|
|
pageId, revisionId, path, shareLinkId, expandContentWidth,
|
|
|
@@ -215,7 +215,7 @@ const SubNavButtonsSubstance = (props: SubNavButtonsSubstanceProps): JSX.Element
|
|
|
];
|
|
|
|
|
|
return (
|
|
|
- <div className={`grw-sub-nav-buttons ${styles['grw-sub-nav-buttons']} d-flex`} style={{ gap: '2px' }}>
|
|
|
+ <div className={`grw-page-controls ${styles['grw-page-controls']} d-flex`} style={{ gap: '2px' }}>
|
|
|
{revisionId != null && (
|
|
|
<SubscribeButton
|
|
|
status={pageInfo.subscriptionStatus}
|
|
|
@@ -263,7 +263,7 @@ const SubNavButtonsSubstance = (props: SubNavButtonsSubstanceProps): JSX.Element
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-export type SubNavButtonsProps = CommonProps & {
|
|
|
+type PageControlsProps = CommonProps & {
|
|
|
pageId: string,
|
|
|
shareLinkId?: string | null,
|
|
|
revisionId?: string | null,
|
|
|
@@ -271,7 +271,7 @@ export type SubNavButtonsProps = CommonProps & {
|
|
|
expandContentWidth?: boolean,
|
|
|
};
|
|
|
|
|
|
-export const SubNavButtons = (props: SubNavButtonsProps): JSX.Element => {
|
|
|
+export const PageControls = memo((props: PageControlsProps): JSX.Element => {
|
|
|
const {
|
|
|
pageId, revisionId, path, shareLinkId, expandContentWidth,
|
|
|
onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem, onClickSwitchContentWidth,
|
|
|
@@ -288,7 +288,7 @@ export const SubNavButtons = (props: SubNavButtonsProps): JSX.Element => {
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
- <SubNavButtonsSubstance
|
|
|
+ <PageControlsSubstance
|
|
|
{...props}
|
|
|
pageInfo={pageInfo}
|
|
|
pageId={pageId}
|
|
|
@@ -301,4 +301,4 @@ export const SubNavButtons = (props: SubNavButtonsProps): JSX.Element => {
|
|
|
expandContentWidth={expandContentWidth}
|
|
|
/>
|
|
|
);
|
|
|
-};
|
|
|
+});
|