mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Remove unnecessary use of SingleOrMany<SafeReactNode>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
adb288e48a
commit
e88de58b5d
23 files changed
+44
-44
No files matched your search
@@ -5,7 +5,7 @@
|
||||
|
||||
import "./animate.scss";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, noop } from "@k8slens/utilities";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import type { RequestAnimationFrame } from "./request-animation-frame.injectable";
|
||||
@@ -22,7 +22,7 @@ export interface AnimateProps {
|
||||
onLeave?: () => void;
|
||||
enterDuration?: number;
|
||||
leaveDuration?: number;
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
|
||||
@@ -8,7 +8,7 @@ import styles from "./avatar.module.scss";
|
||||
import type { ImgHTMLAttributes, MouseEventHandler } from "react";
|
||||
import React from "react";
|
||||
import randomColor from "randomcolor";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { computeDefaultShortName } from "../../../common/catalog/helpers";
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface AvatarProps {
|
||||
variant?: "circle" | "rounded" | "square";
|
||||
imgProps?: ImgHTMLAttributes<HTMLImageElement>;
|
||||
disabled?: boolean;
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
className?: string;
|
||||
id?: string;
|
||||
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||
|
||||
@@ -8,7 +8,7 @@ import styles from "./badge.module.scss";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { action, observable } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { withTooltip } from "@k8slens/tooltip";
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
expandable?: boolean;
|
||||
disabled?: boolean;
|
||||
scrollable?: boolean;
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
}
|
||||
|
||||
// Common handler for all Badge instances
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import "./checkbox.scss";
|
||||
import React from "react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, noop } from "@k8slens/utilities";
|
||||
|
||||
export interface CheckboxProps {
|
||||
@@ -15,7 +15,7 @@ export interface CheckboxProps {
|
||||
disabled?: boolean;
|
||||
value?: boolean;
|
||||
onChange?(value: boolean, evt: React.ChangeEvent<HTMLInputElement>): void;
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
}
|
||||
|
||||
export function Checkbox({ label, inline, className, value, children, onChange = noop, disabled, ...inputProps }: CheckboxProps) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { createPortal } from "react-dom";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { reaction } from "mobx";
|
||||
import { Animate } from "../animate";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, noop, stopPropagation } from "@k8slens/utilities";
|
||||
import type { ObservableHistory } from "mobx-observable-history";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
@@ -30,7 +30,7 @@ export interface DialogProps {
|
||||
pinned?: boolean;
|
||||
animated?: boolean;
|
||||
"data-testid"?: string;
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
}
|
||||
|
||||
interface DialogState {
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
import "./drawer-param-toggler.scss";
|
||||
import React from "react";
|
||||
import { Icon } from "../icon";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface DrawerParamTogglerProps {
|
||||
label: string | number;
|
||||
children: SingleOrMany<SafeReactNode>;
|
||||
children: SafeReactNode;
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
||||
@@ -8,7 +8,7 @@ import "./drawer.scss";
|
||||
import React from "react";
|
||||
import { clipboard } from "electron";
|
||||
import { createPortal } from "react-dom";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, noop } from "@k8slens/utilities";
|
||||
import { Icon } from "../icon";
|
||||
import type { AnimateName } from "../animate";
|
||||
@@ -39,7 +39,7 @@ export interface DrawerProps {
|
||||
animation?: AnimateName;
|
||||
onClose?: () => void;
|
||||
toolbar?: SafeReactNode;
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
"data-testid"?: string;
|
||||
testIdForClose?: string;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { toSafeReactChildrenArray } from "@k8slens/utilities";
|
||||
import type { HTMLAttributes } from "react";
|
||||
import React, { useState } from "react";
|
||||
@@ -11,7 +11,7 @@ import { Menu } from "../menu";
|
||||
|
||||
interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
|
||||
contentForToggle: SafeReactNode;
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
}
|
||||
|
||||
export function Dropdown(props: DropdownProps) {
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
import "./hotbar-menu.scss";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface HotbarCellProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
index: number;
|
||||
innerRef?: React.Ref<HTMLDivElement>;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import Workloads from "./workloads.svg";
|
||||
import type { Logger } from "@k8slens/logger";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import type { SingleOrMany, SafeReactNode } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
|
||||
const hrefValidation = /https?:\/\//;
|
||||
|
||||
@@ -159,7 +159,7 @@ export interface BaseIconProps {
|
||||
}
|
||||
|
||||
export interface IconProps extends React.HTMLAttributes<any>, BaseIconProps {
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
}
|
||||
|
||||
export function isSvg(content: string): boolean {
|
||||
|
||||
@@ -7,7 +7,7 @@ import styles from "./main-layout.module.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { ErrorBoundary } from "@k8slens/error-boundary";
|
||||
import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "@k8slens/resizing-anchor";
|
||||
@@ -20,7 +20,7 @@ export interface MainLayoutProps {
|
||||
sidebar: SafeReactNode;
|
||||
className?: string;
|
||||
footer?: SafeReactNode;
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
|
||||
import "./sub-header.scss";
|
||||
import React from "react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface SubHeaderProps {
|
||||
className?: string;
|
||||
withLine?: boolean; // add bottom line
|
||||
compact?: boolean; // no extra padding around content
|
||||
children: SingleOrMany<SafeReactNode>;
|
||||
children: SafeReactNode;
|
||||
}
|
||||
|
||||
export class SubHeader extends React.Component<SubHeaderProps> {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import "./sub-title.scss";
|
||||
import React from "react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface SubTitleProps {
|
||||
@@ -13,7 +13,7 @@ export interface SubTitleProps {
|
||||
title: SafeReactNode;
|
||||
compact?: boolean; // no bottom padding
|
||||
id?: string;
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
}
|
||||
|
||||
export class SubTitle extends React.Component<SubTitleProps> {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import "./line-progress.scss";
|
||||
import React from "react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { withTooltip } from "@k8slens/tooltip";
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface LineProgressProps extends React.HTMLProps<HTMLDivElement> {
|
||||
max?: number;
|
||||
className?: any;
|
||||
precise?: number;
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
}
|
||||
|
||||
function valuePercent({ value, min, max, precise }: Required<Pick<LineProgressProps, "value" | "min" | "max" | "precise">>) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { RequestIdleCallback } from "./request-idle-callback.injectable";
|
||||
import type { CancelIdleCallback } from "./cancel-idle-callback.injectable";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
@@ -14,7 +14,7 @@ import idleCallbackTimeoutInjectable from "./idle-callback-timeout.injectable";
|
||||
|
||||
export interface RenderDelayProps {
|
||||
placeholder?: SafeReactNode;
|
||||
children: SingleOrMany<SafeReactNode>;
|
||||
children: SafeReactNode;
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
import "./status-brick.scss";
|
||||
|
||||
import React from "react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { withTooltip } from "@k8slens/tooltip";
|
||||
|
||||
export interface StatusBrickProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
children?: SingleOrMany<SafeReactNode>;
|
||||
children?: SafeReactNode;
|
||||
}
|
||||
|
||||
export const StatusBrick = withTooltip(({ className, ...elemProps }: StatusBrickProps) => (
|
||||
|
||||
Reference in new issue
Block a user