Skip to content

Commit 6a3b3b3

Browse files
committed
Remove more default React import
1 parent fff49c7 commit 6a3b3b3

File tree

8 files changed

+16
-20
lines changed

8 files changed

+16
-20
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React from "react";
2-
import ReactDOM from "react-dom";
1+
import {ReactNode} from "react";
2+
import {createPortal} from "react-dom";
33

44
interface DropdownPortalProps {
5-
children: React.ReactNode;
5+
children: ReactNode;
66
}
77

88
export default function DropdownPortal({ children }: DropdownPortalProps) {
@@ -13,5 +13,5 @@ export default function DropdownPortal({ children }: DropdownPortalProps) {
1313
return null;
1414
}
1515

16-
return ReactDOM.createPortal(children, container);
16+
return createPortal(children, container);
1717
}

src/main/frontend/common/components/dropdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Tippy, { TippyProps } from "@tippyjs/react";
2-
import { ReactNode, useState } from "react";
2+
import { isValidElement, ReactElement, ReactNode, useState } from "react";
33

44
import Tooltip from "./tooltip.tsx";
55

@@ -33,7 +33,7 @@ export default function Dropdown({
3333
);
3434
}
3535

36-
if (React.isValidElement(item)) {
36+
if (isValidElement(item)) {
3737
return (
3838
<div key={index} className="jenkins-dropdown__custom-item">
3939
{item}
@@ -89,7 +89,7 @@ export const DefaultDropdownProps: TippyProps = {
8989
};
9090

9191
interface DropdownProps {
92-
items: (DropdownItem | React.ReactElement | "separator")[];
92+
items: (DropdownItem | ReactElement | "separator")[];
9393
disabled?: boolean;
9494
className?: string;
9595
}

src/main/frontend/pipeline-console-view/pipeline-console/main/components/skeleton.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import "./skeleton.scss";
22

3-
import React from "react";
4-
53
export default function Skeleton({ height }: { height?: number }) {
64
return (
75
<div

src/main/frontend/pipeline-console-view/pipeline-console/main/components/stages-customization.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import "./stages-customization.scss";
22

3-
import React from "react";
3+
import { ChangeEvent } from "react";
44

55
import {
66
MainViewVisibility,
@@ -16,11 +16,11 @@ export default function StagesCustomization() {
1616
setStageViewPosition,
1717
} = useLayoutPreferences();
1818

19-
const handleViewChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
19+
const handleViewChange = (e: ChangeEvent<HTMLSelectElement>) => {
2020
setMainViewVisibility(e.target.value as MainViewVisibility);
2121
};
2222

23-
const handlePositionChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
23+
const handlePositionChange = (e: ChangeEvent<HTMLSelectElement>) => {
2424
setStageViewPosition(e.target.value as StageViewPosition);
2525
};
2626

src/main/frontend/pipeline-console-view/pipeline-console/main/components/stages.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import "./stages.scss";
22

3-
import React, { CSSProperties, useEffect, useState } from "react";
3+
import { CSSProperties, useEffect, useState } from "react";
44
import {
55
TransformComponent,
66
TransformWrapper,

src/main/frontend/pipeline-console-view/pipeline-console/main/providers/user-preference-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {
1+
import {
22
createContext,
33
ReactNode,
44
useContext,

src/main/frontend/pipeline-console-view/pipeline-console/main/split-view.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import "./split-view.scss";
22

3-
import React, { useEffect, useRef, useState } from "react";
3+
import { Children, MouseEvent as ReactMouseEvent, ReactNode, useEffect, useRef, useState } from "react";
44

55
import { useLayoutPreferences } from "./providers/user-preference-provider.tsx";
66

@@ -43,7 +43,7 @@ export default function SplitView(props: SplitViewNewProps) {
4343

4444
const dividerRef = useRef<HTMLDivElement>(null);
4545

46-
const startDragging = (e: React.MouseEvent) => {
46+
const startDragging = (e: ReactMouseEvent) => {
4747
setIsDragging(true);
4848
e.preventDefault();
4949
};
@@ -117,7 +117,7 @@ export default function SplitView(props: SplitViewNewProps) {
117117
});
118118

119119
// If we only have one child, just return it
120-
const childrenArray = React.Children.toArray(props.children).filter(Boolean);
120+
const childrenArray = Children.toArray(props.children).filter(Boolean);
121121
if (childrenArray.length === 1) {
122122
return <>{childrenArray[0]}</>;
123123
}
@@ -153,7 +153,7 @@ export default function SplitView(props: SplitViewNewProps) {
153153
}
154154

155155
interface SplitViewNewProps {
156-
children: React.ReactNode[];
156+
children: ReactNode[];
157157
direction?: "horizontal" | "vertical";
158158
storageKey: "stages" | "graph";
159159
}

src/main/frontend/pipeline-console-view/pipeline-console/main/symbols.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from "react";
2-
31
export const DOCUMENT = (
42
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
53
<path

0 commit comments

Comments
 (0)