Export WhitespaceMode typing

This commit is contained in:
Thomas Zerr
2024-10-25 14:26:18 +02:00
parent 50940b908e
commit 824f4224d1
3 changed files with 11 additions and 11 deletions

View File

@@ -17,8 +17,7 @@
import React, { FC, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Checkbox } from "@scm-manager/ui-core";
export type HideWhiteSpaceMode = "ALL" | "NONE";
import { WhitespaceMode } from "./LoadingDiff";
type DiffDropDownProps = {
collapseDiffs: () => void;
@@ -27,8 +26,8 @@ type DiffDropDownProps = {
*/
ignoreWhitespaces?: () => void;
renderOnMount: boolean;
ignoreWhitespacesMode?: HideWhiteSpaceMode;
setIgnoreWhitespacesMode?: (hideWhiteSpaceMode: HideWhiteSpaceMode) => void;
ignoreWhitespacesMode?: WhitespaceMode;
setIgnoreWhitespacesMode?: (hideWhiteSpaceMode: WhitespaceMode) => void;
};
const DiffDropDown: FC<DiffDropDownProps> = ({
collapseDiffs,

View File

@@ -29,7 +29,8 @@ import DiffFileTree from "./diff/DiffFileTree";
import { DiffContent, FileTreeContent } from "./diff/styledElements";
import { useHistory, useLocation } from "react-router-dom";
import { getFileNameFromHash } from "./diffs";
import { HideWhiteSpaceMode } from "./DiffDropDown";
export type WhitespaceMode = "ALL" | "NONE";
type Props = DiffObjectProps & {
url: string;
@@ -56,7 +57,7 @@ const PartialNotification: FC<NotificationProps> = ({ fetchNextPage, isFetchingN
};
const LoadingDiff: FC<Props> = ({ url, limit, refetchOnWindowFocus, ...props }) => {
const [ignoreWhitespace, setIgnoreWhitespace] = useState<HideWhiteSpaceMode>("NONE");
const [ignoreWhitespace, setIgnoreWhitespace] = useState<WhitespaceMode>("NONE");
const [collapsed, setCollapsed] = useState(false);
const [prevHash, setPrevHash] = useState("");
const location = useLocation();
@@ -107,7 +108,7 @@ const LoadingDiff: FC<Props> = ({ url, limit, refetchOnWindowFocus, ...props })
collapseDiffs={collapseDiffs}
renderOnMount={true}
ignoreWhitespacesMode={ignoreWhitespace}
setIgnoreWhitespacesMode={(hideWhiteSpaceMode: HideWhiteSpaceMode) => {
setIgnoreWhitespacesMode={(hideWhiteSpaceMode: WhitespaceMode) => {
setIgnoreWhitespace(hideWhiteSpaceMode);
}}
/>

View File

@@ -22,7 +22,7 @@ import {
AnnotationFactoryContext,
DiffEventHandler,
DiffEventContext,
DiffObjectProps
DiffObjectProps,
} from "./DiffTypes";
import { FileDiff as File, FileChangeType, Hunk, Change, ChangeType } from "@scm-manager/ui-types";
@@ -36,7 +36,7 @@ export { default as Diff } from "./Diff";
export { default as DiffFile } from "./DiffFile";
export { default as DiffButton } from "./DiffButton";
export { FileControlFactory } from "./DiffTypes";
export { default as LoadingDiff } from "./LoadingDiff";
export { default as LoadingDiff, WhitespaceMode } from "./LoadingDiff";
export { DefaultCollapsed, DefaultCollapsedFunction } from "./defaultCollapsed";
export { default as RepositoryAvatar } from "./RepositoryAvatar";
export { default as RepositoryEntry } from "./RepositoryEntry";
@@ -46,7 +46,7 @@ export { default as CommitAuthor } from "./CommitAuthor";
export { default as HealthCheckFailureDetail } from "./HealthCheckFailureDetail";
export { default as RepositoryFlags } from "./RepositoryFlags";
export { default as DiffDropDown } from "./DiffDropDown";
export { default as DiffStatistics } from "./DiffStatistics"
export { default as DiffStatistics } from "./DiffStatistics";
export {
File,
@@ -59,5 +59,5 @@ export {
AnnotationFactoryContext,
DiffEventHandler,
DiffEventContext,
DiffObjectProps
DiffObjectProps,
};