Client/Shared: Hide close button for Sdk.

This commit is contained in:
Tatiana Lopaeva 2024-08-23 20:14:14 +03:00
parent 7f7882f4ff
commit 3017d36a76
7 changed files with 27 additions and 7 deletions

View File

@ -29,12 +29,15 @@ import {
TFilesSettings,
TFolder,
} from "@docspace/shared/api/files/types";
import { TBreadCrumb } from "@docspace/shared/components/selector/Selector.types";
import {
TBreadCrumb,
TSelectorHeader,
} from "@docspace/shared/components/selector/Selector.types";
import { DeviceType } from "@docspace/shared/enums";
import { TTheme } from "@docspace/shared/themes";
import SocketIOHelper from "@docspace/shared/utils/socket";
export type FilesSelectorProps = {
export type FilesSelectorProps = TSelectorHeader & {
isPanelVisible: boolean;
// withoutImmediatelyClose: boolean;
isThirdParty: boolean;

View File

@ -140,6 +140,7 @@ const FilesSelectorWrapper = ({
openRoot,
filesSettings,
headerProps,
}: FilesSelectorProps) => {
const { t }: { t: TTranslation } = useTranslation([
"Files",
@ -392,6 +393,7 @@ const FilesSelectorWrapper = ({
getFilesArchiveError={getFilesArchiveError}
withCreate={(isMove || isCopy || isRestore || isRestoreAll) ?? false}
filesSettings={filesSettings}
headerProps={headerProps}
/>
);
};

View File

@ -262,7 +262,10 @@ const Sdk = ({
: {};
const headerProps = frameConfig?.showSelectorHeader
? { withHeader: true, headerProps: { headerLabel: "" } }
? {
withHeader: true,
headerProps: { headerLabel: "", isCloseable: false },
}
: {};
component = (
@ -301,6 +304,7 @@ const Sdk = ({
currentFolderId={frameConfig?.id}
openRoot={selectorOpenRoot}
descriptionText={formatsDescription[frameConfig?.filterParam] || ""}
headerProps={{ isCloseable: false }}
/>
);
break;

View File

@ -74,6 +74,7 @@ export type BreadCrumbsProps = {
export type HeaderProps = {
headerLabel: string;
onCloseClick: () => void;
isCloseable?: boolean;
} & THeaderBackButton;
export type TSelectorHeader =

View File

@ -36,7 +36,9 @@ const Header = React.memo(
withoutBackButton,
headerLabel,
withoutBorder,
isCloseable,
}: HeaderProps) => {
console.log("isCloseable", isCloseable);
return (
<AsideHeader
header={headerLabel}
@ -46,6 +48,7 @@ const Header = React.memo(
onBackClick={onBackClick}
onCloseClick={onCloseClick}
withoutBorder={withoutBorder}
isCloseable={isCloseable}
/>
);
},

View File

@ -28,6 +28,7 @@ import { TSelectorItem } from "../../components/selector";
import {
TBreadCrumb,
TInfoBar,
TSelectorHeader,
} from "../../components/selector/Selector.types";
import {
TFileSecurity,
@ -143,7 +144,8 @@ export type TSelectedFileInfo = {
export type TGetIcon = (size: number, fileExst: string) => string;
export type FilesSelectorProps = TInfoBar &
export type FilesSelectorProps = TSelectorHeader &
TInfoBar &
(
| {
getIcon: TGetIcon;

View File

@ -114,6 +114,7 @@ const FilesSelectorComponent = ({
createDefineRoomType,
withInfoBar,
infoBarData,
headerProps,
}: FilesSelectorProps) => {
const theme = useTheme();
const { t } = useTranslation(["Common"]);
@ -475,10 +476,14 @@ const FilesSelectorComponent = ({
openRoot,
]);
const headerProps: TSelectorHeader = withHeader
const headerSelectorProps: TSelectorHeader = withHeader
? {
withHeader,
headerProps: { headerLabel, onCloseClick: onCancel },
headerProps: {
...headerProps,
headerLabel,
onCloseClick: onCancel,
},
}
: {};
@ -556,7 +561,7 @@ const FilesSelectorComponent = ({
const SelectorBody = (
<Selector
{...headerProps}
{...headerSelectorProps}
{...searchProps}
{...submitButtonProps}
{...cancelButtonProps}