1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Remove explicit "round-black" theme prop from all inputs

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-01-28 11:32:20 +03:00
parent 02d270a8c7
commit 5ff83abede
25 changed files with 12 additions and 51 deletions

View File

@ -93,7 +93,6 @@ export class ConfigMapDetails extends React.Component<Props> {
<div className="flex gaps align-flex-start"> <div className="flex gaps align-flex-start">
<Input <Input
multiLine multiLine
theme="round-black"
className="box grow" className="box grow"
value={value} value={value}
onChange={v => this.data.set(name, v)} onChange={v => this.data.set(name, v)}

View File

@ -90,7 +90,6 @@ export class SecretDetails extends React.Component<Props> {
<div className="flex gaps align-center"> <div className="flex gaps align-center">
<Input <Input
multiLine multiLine
theme="round-black"
className="box grow" className="box grow"
value={value || ""} value={value || ""}
onChange={value => this.editData(name, value, !revealSecret)} onChange={value => this.editData(name, value, !revealSecret)}

View File

@ -64,7 +64,6 @@ export class CRDDetails extends React.Component<Props> {
<DrawerItem name="Conversion" className="flex gaps align-flex-start"> <DrawerItem name="Conversion" className="flex gaps align-flex-start">
<Input <Input
multiLine multiLine
theme="round-black"
className="box grow" className="box grow"
value={crd.getConversion()} value={crd.getConversion()}
readOnly readOnly

View File

@ -33,7 +33,6 @@ function convertSpecValue(value: any): any {
<Input <Input
readOnly readOnly
multiLine multiLine
theme="round-black"
className="box grow" className="box grow"
value={JSON.stringify(value, null, 2)} value={JSON.stringify(value, null, 2)}
/> />

View File

@ -60,7 +60,6 @@ const NonInjectedInstall: React.FC<Dependencies & Props> = ({
<div className="flex-1"> <div className="flex-1">
<Input <Input
className="box grow mr-6" className="box grow mr-6"
theme="round-black"
disabled={ disabled={
extensionInstallationStateStore.anyPreInstallingOrInstalling extensionInstallationStateStore.anyPreInstallingOrInstalling
} }

View File

@ -75,7 +75,6 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems })
</p> </p>
<Input <Input
theme="round-black"
validators={isUrl} validators={isUrl}
value={customUrl} value={customUrl}
onChange={setCustomUrl} onChange={setCustomUrl}

View File

@ -61,7 +61,6 @@ export const Editor = observer(() => {
<section> <section>
<SubTitle title="Tab size"/> <SubTitle title="Tab size"/>
<Input <Input
theme="round-black"
type="number" type="number"
min={1} min={1}
validators={InputValidators.isNumber} validators={InputValidators.isNumber}
@ -72,7 +71,6 @@ export const Editor = observer(() => {
<section> <section>
<SubTitle title="Font size"/> <SubTitle title="Font size"/>
<Input <Input
theme="round-black"
type="number" type="number"
min={10} min={10}
validators={InputValidators.isNumber} validators={InputValidators.isNumber}
@ -83,7 +81,6 @@ export const Editor = observer(() => {
<section> <section>
<SubTitle title="Font family"/> <SubTitle title="Font family"/>
<Input <Input
theme="round-black"
type="text" type="text"
validators={InputValidators.isNumber} validators={InputValidators.isNumber}
value={editorConfiguration.fontFamily} value={editorConfiguration.fontFamily}

View File

@ -62,7 +62,6 @@ const NonInjectedKubectlBinaries: React.FC<Dependencies> = (({ defaultPathForKub
<section> <section>
<SubTitle title="Directory for binaries" /> <SubTitle title="Directory for binaries" />
<Input <Input
theme="round-black"
value={downloadPath} value={downloadPath}
placeholder={defaultPathForKubectlBinaries} placeholder={defaultPathForKubectlBinaries}
validators={pathValidator} validators={pathValidator}
@ -78,7 +77,6 @@ const NonInjectedKubectlBinaries: React.FC<Dependencies> = (({ defaultPathForKub
<section> <section>
<SubTitle title="Path to kubectl binary" /> <SubTitle title="Path to kubectl binary" />
<Input <Input
theme="round-black"
placeholder={bundledKubectlPath()} placeholder={bundledKubectlPath()}
value={binariesPath} value={binariesPath}
validators={pathValidator} validators={pathValidator}

View File

@ -20,7 +20,6 @@ export const LensProxy = observer(() => {
<h2 data-testid="proxy-header">Proxy</h2> <h2 data-testid="proxy-header">Proxy</h2>
<SubTitle title="HTTP Proxy"/> <SubTitle title="HTTP Proxy"/>
<Input <Input
theme="round-black"
placeholder="Type HTTP proxy url (example: http://proxy.acme.org:8080)" placeholder="Type HTTP proxy url (example: http://proxy.acme.org:8080)"
value={proxy} value={proxy}
onChange={v => setProxy(v)} onChange={v => setProxy(v)}

View File

@ -28,7 +28,6 @@ export const Terminal = observer(() => {
<section id="shell"> <section id="shell">
<SubTitle title="Terminal Shell Path"/> <SubTitle title="Terminal Shell Path"/>
<Input <Input
theme="round-black"
placeholder={defaultShell} placeholder={defaultShell}
value={userStore.shell} value={userStore.shell}
onChange={(value) => userStore.shell = value} onChange={(value) => userStore.shell = value}
@ -61,7 +60,6 @@ export const Terminal = observer(() => {
<section> <section>
<SubTitle title="Font size"/> <SubTitle title="Font size"/>
<Input <Input
theme="round-black"
type="number" type="number"
min={10} min={10}
validators={InputValidators.isNumber} validators={InputValidators.isNumber}
@ -72,7 +70,6 @@ export const Terminal = observer(() => {
<section> <section>
<SubTitle title="Font family"/> <SubTitle title="Font family"/>
<Input <Input
theme="round-black"
type="text" type="text"
value={userStore.terminalConfig.fontFamily} value={userStore.terminalConfig.fontFamily}
onChange={(value) => userStore.terminalConfig.fontFamily=value} onChange={(value) => userStore.terminalConfig.fontFamily=value}

View File

@ -215,6 +215,7 @@ export class ClusterRoleBindingDialog extends React.Component<Props> {
<b>Users</b> <b>Users</b>
<EditableList <EditableList
lightTheme
placeholder="Bind to User Account ..." placeholder="Bind to User Account ..."
add={(newUser) => this.selectedUsers.add(newUser)} add={(newUser) => this.selectedUsers.add(newUser)}
items={Array.from(this.selectedUsers)} items={Array.from(this.selectedUsers)}
@ -223,6 +224,7 @@ export class ClusterRoleBindingDialog extends React.Component<Props> {
<b>Groups</b> <b>Groups</b>
<EditableList <EditableList
lightTheme
placeholder="Bind to User Group ..." placeholder="Bind to User Group ..."
add={(newGroup) => this.selectedGroups.add(newGroup)} add={(newGroup) => this.selectedGroups.add(newGroup)}
items={Array.from(this.selectedGroups)} items={Array.from(this.selectedGroups)}

View File

@ -212,6 +212,7 @@ export class RoleBindingDialog extends React.Component<Props> {
<b>Users</b> <b>Users</b>
<EditableList <EditableList
lightTheme
placeholder="Bind to User Account ..." placeholder="Bind to User Account ..."
add={(newUser) => this.selectedUsers.add(newUser)} add={(newUser) => this.selectedUsers.add(newUser)}
items={Array.from(this.selectedUsers)} items={Array.from(this.selectedUsers)}
@ -220,6 +221,7 @@ export class RoleBindingDialog extends React.Component<Props> {
<b>Groups</b> <b>Groups</b>
<EditableList <EditableList
lightTheme
placeholder="Bind to User Group ..." placeholder="Bind to User Group ..."
add={(newGroup) => this.selectedGroups.add(newGroup)} add={(newGroup) => this.selectedGroups.add(newGroup)}
items={Array.from(this.selectedGroups)} items={Array.from(this.selectedGroups)}

View File

@ -57,7 +57,6 @@ class NonInjectedWeblinkAddCommand extends React.Component<Dependencies> {
<Input <Input
placeholder="Link URL" placeholder="Link URL"
autoFocus={this.nameHidden} autoFocus={this.nameHidden}
theme="round-black"
data-test-id="command-palette-weblink-add-url" data-test-id="command-palette-weblink-add-url"
validators={[isUrl]} validators={[isUrl]}
dirty={this.dirty} dirty={this.dirty}
@ -75,7 +74,6 @@ class NonInjectedWeblinkAddCommand extends React.Component<Dependencies> {
<Input <Input
placeholder="Name (optional)" placeholder="Name (optional)"
autoFocus={true} autoFocus={true}
theme="round-black"
data-test-id="command-palette-weblink-add-name" data-test-id="command-palette-weblink-add-name"
onSubmit={(v) => this.onSubmit(v)} onSubmit={(v) => this.onSubmit(v)}
dirty={true}/> dirty={true}/>

View File

@ -40,7 +40,6 @@ export class ClusterAccessibleNamespaces extends React.Component<Props> {
this.namespaces.delete(oldNamespace); this.namespaces.delete(oldNamespace);
this.props.cluster.accessibleNamespaces = Array.from(this.namespaces); this.props.cluster.accessibleNamespaces = Array.from(this.namespaces);
}} }}
inputTheme="round-black"
/> />
<small className="hint"> <small className="hint">
This setting is useful for manually specifying which namespaces you have access to. This is useful when you do not have permissions to list namespaces. This setting is useful for manually specifying which namespaces you have access to. This is useful when you do not have permissions to list namespaces.

View File

@ -149,7 +149,6 @@ export const ClusterLocalTerminalSetting = observer(({ cluster }: Props) => {
<section className="working-directory"> <section className="working-directory">
<SubTitle title="Working Directory"/> <SubTitle title="Working Directory"/>
<Input <Input
theme="round-black"
value={directory} value={directory}
data-testid="working-directory" data-testid="working-directory"
onChange={setDirectory} onChange={setDirectory}
@ -182,7 +181,6 @@ export const ClusterLocalTerminalSetting = observer(({ cluster }: Props) => {
<section className="default-namespace"> <section className="default-namespace">
<SubTitle title="Default Namespace"/> <SubTitle title="Default Namespace"/>
<Input <Input
theme="round-black"
data-testid="default-namespace" data-testid="default-namespace"
value={defaultNamespace} value={defaultNamespace}
onChange={setDefaultNamespaces} onChange={setDefaultNamespaces}

View File

@ -47,7 +47,6 @@ export class ClusterNameSetting extends React.Component<Props> {
<> <>
<SubTitle title="Cluster Name" /> <SubTitle title="Cluster Name" />
<Input <Input
theme="round-black"
validators={isRequired} validators={isRequired}
value={this.name} value={this.name}
onChange={this.onChange} onChange={this.onChange}

View File

@ -38,7 +38,6 @@ export class ClusterNodeShellSetting extends React.Component<Props> {
<section> <section>
<SubTitle title="Node shell image" id="node-shell-image"/> <SubTitle title="Node shell image" id="node-shell-image"/>
<Input <Input
theme="round-black"
placeholder={`Default image: ${initialNodeShellImage}`} placeholder={`Default image: ${initialNodeShellImage}`}
value={this.nodeShellImage} value={this.nodeShellImage}
onChange={value => this.nodeShellImage = value} onChange={value => this.nodeShellImage = value}
@ -63,7 +62,6 @@ export class ClusterNodeShellSetting extends React.Component<Props> {
<SubTitle title="Image pull secret" id="image-pull-secret"/> <SubTitle title="Image pull secret" id="image-pull-secret"/>
<Input <Input
placeholder="Specify a secret name..." placeholder="Specify a secret name..."
theme="round-black"
value={this.imagePullSecret} value={this.imagePullSecret}
onChange={value => this.imagePullSecret = value} onChange={value => this.imagePullSecret = value}
iconRight={ iconRight={

View File

@ -134,7 +134,6 @@ export class ClusterPrometheusSetting extends React.Component<Props> {
<section> <section>
<SubTitle title="Prometheus service address" /> <SubTitle title="Prometheus service address" />
<Input <Input
theme="round-black"
value={this.path} value={this.path}
onChange={(value) => this.path = value} onChange={(value) => this.path = value}
onBlur={this.onSavePath} onBlur={this.onSavePath}

View File

@ -44,7 +44,6 @@ export class ClusterProxySetting extends React.Component<Props> {
<> <>
<SubTitle title="HTTP Proxy" id="http-proxy" /> <SubTitle title="HTTP Proxy" id="http-proxy" />
<Input <Input
theme="round-black"
value={this.proxy} value={this.proxy}
onChange={this.onChange} onChange={this.onChange}
onBlur={this.save} onBlur={this.save}

View File

@ -9,7 +9,7 @@ import { observer } from "mobx-react";
import React from "react"; import React from "react";
import { Icon } from "../icon"; import { Icon } from "../icon";
import { Input, InputProps, InputValidator } from "../input"; import { Input, InputValidator } from "../input";
import { boundMethod } from "../../utils"; import { boundMethod } from "../../utils";
export interface Props<T> { export interface Props<T> {
@ -22,13 +22,12 @@ export interface Props<T> {
// An optional prop used to convert T to a displayable string // An optional prop used to convert T to a displayable string
// defaults to `String` // defaults to `String`
renderItem?: (item: T, index: number) => React.ReactNode, renderItem?: (item: T, index: number) => React.ReactNode,
inputTheme?: InputProps["theme"]; lightTheme?: boolean;
} }
const defaultProps: Partial<Props<any>> = { const defaultProps: Partial<Props<any>> = {
placeholder: "Add new item...", placeholder: "Add new item...",
renderItem: (item: any, index: number) => <React.Fragment key={index}>{item}</React.Fragment>, renderItem: (item: any, index: number) => <React.Fragment key={index}>{item}</React.Fragment>,
inputTheme: "round",
}; };
@observer @observer
@ -44,13 +43,13 @@ export class EditableList<T> extends React.Component<Props<T>> {
} }
render() { render() {
const { items, remove, renderItem, placeholder, validators, inputTheme } = this.props; const { items, remove, renderItem, placeholder, validators, lightTheme } = this.props;
return ( return (
<div className="EditableList"> <div className="EditableList">
<div className="el-header"> <div className="el-header">
<Input <Input
theme={inputTheme} lightTheme={lightTheme}
onSubmit={this.onSubmit} onSubmit={this.onSubmit}
validators={validators} validators={validators}
placeholder={placeholder} placeholder={placeholder}

View File

@ -33,7 +33,6 @@ const NonInjectedHotbarAddCommand = observer(({ closeCommandOverlay, addHotbar,
<Input <Input
placeholder="Hotbar name" placeholder="Hotbar name"
autoFocus={true} autoFocus={true}
theme="round-black"
data-test-id="command-palette-hotbar-add-name" data-test-id="command-palette-hotbar-add-name"
validators={uniqueHotbarName} validators={uniqueHotbarName}
onSubmit={onSubmit} onSubmit={onSubmit}

View File

@ -55,7 +55,6 @@ const NonInjectedHotbarRenameCommand = observer(({ closeCommandOverlay, hotbarMa
onChange={setHotbarName} onChange={setHotbarName}
placeholder="New hotbar name" placeholder="New hotbar name"
autoFocus={true} autoFocus={true}
theme="round-black"
validators={uniqueHotbarName} validators={uniqueHotbarName}
onSubmit={onSubmit} onSubmit={onSubmit}
showValidationLine={true} showValidationLine={true}

View File

@ -43,7 +43,7 @@
} }
} }
&.light { &.lightTheme {
label { label {
background: #f6f6f7; /* inputControlBackground from light theme */ background: #f6f6f7; /* inputControlBackground from light theme */
border-color: #cccdcf; /* inputControlBorder from light theme */ border-color: #cccdcf; /* inputControlBorder from light theme */

View File

@ -37,7 +37,7 @@ export interface IconDataFnArg {
export type IconData = string | React.ReactNode | ((opt: IconDataFnArg) => React.ReactNode); export type IconData = string | React.ReactNode | ((opt: IconDataFnArg) => React.ReactNode);
export type InputProps = Omit<InputElementProps, "onChange" | "onSubmit"> & { export type InputProps = Omit<InputElementProps, "onChange" | "onSubmit"> & {
theme?: "round-black" | "round"; lightTheme?: boolean; // Forced light theme, may be used for dialogs which is always "bright"
className?: string; className?: string;
value?: string; value?: string;
trim?: boolean; trim?: boolean;
@ -313,20 +313,6 @@ export class Input extends React.Component<InputProps, State> {
} }
} }
get themeSelection(): Record<string, boolean> {
const { theme } = this.props;
if (!theme) {
return {};
}
return {
theme: true,
round: true,
black: theme === "round-black",
};
}
@boundMethod @boundMethod
bindRef(elem: InputElement) { bindRef(elem: InputElement) {
this.input = elem; this.input = elem;
@ -348,7 +334,7 @@ export class Input extends React.Component<InputProps, State> {
render() { render() {
const { const {
multiLine, showValidationLine, validators, theme, maxRows, children, showErrorsAsTooltip, multiLine, showValidationLine, validators, lightTheme, maxRows, children, showErrorsAsTooltip,
maxLength, rows, disabled, autoSelectOnFocus, iconLeft, iconRight, contentRight, id, maxLength, rows, disabled, autoSelectOnFocus, iconLeft, iconRight, contentRight, id,
dirty: _dirty, // excluded from passing to input-element dirty: _dirty, // excluded from passing to input-element
defaultValue, defaultValue,
@ -359,7 +345,7 @@ export class Input extends React.Component<InputProps, State> {
const { focused, dirty, valid, validating, errors } = this.state; const { focused, dirty, valid, validating, errors } = this.state;
const className = cssNames("Input", this.props.className, { const className = cssNames("Input", this.props.className, {
...this.themeSelection, lightTheme,
focused, focused,
disabled, disabled,
invalid: !valid, invalid: !valid,

View File

@ -34,7 +34,6 @@ export function List({ columns, data, title, items, filters }: Props) {
<div> <div>
<SearchInput <SearchInput
value={search} value={search}
theme="round-black"
onChange={setSearch} onChange={setSearch}
className={styles.searchInput} className={styles.searchInput}
/> />