mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove material-ui references from
<Switcher/> & <FormSwitcher/> Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
9e65477afc
commit
3ecfaef4be
@ -4,14 +4,18 @@
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import type { FormControlLabelProps } from "@material-ui/core/FormControlLabel";
|
||||
|
||||
interface FormControlLabelProps {
|
||||
control: React.ReactElement<any, any>;
|
||||
label: React.ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use <Switch/> instead from "../switch.tsx".
|
||||
*/
|
||||
export function FormSwitch(props: FormControlLabelProps & { children?: React.ReactNode }) {
|
||||
const ClonedElement = React.cloneElement(props.control, {
|
||||
children: props.label,
|
||||
children: <span>{props.label}</span>,
|
||||
});
|
||||
|
||||
return ClonedElement;
|
||||
|
||||
@ -4,22 +4,20 @@
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import type { SwitchClassKey, SwitchProps } from "@material-ui/core/Switch";
|
||||
import { Switch } from "./switch";
|
||||
|
||||
interface Styles extends Partial<Record<SwitchClassKey, string>> {
|
||||
focusVisible?: string;
|
||||
}
|
||||
|
||||
export interface SwitcherProps extends SwitchProps {
|
||||
classes: Styles;
|
||||
export interface SwitcherProps {
|
||||
disabled?: boolean;
|
||||
children?: React.ReactNode;
|
||||
checked?: boolean;
|
||||
onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use <Switch/> instead from "../switch.tsx".
|
||||
*/
|
||||
export const Switcher = () => (({ disabled, checked, onChange, name, children }: SwitcherProps) => {
|
||||
export function Switcher({ disabled, checked, onChange, name, children }: SwitcherProps) {
|
||||
return (
|
||||
<Switch
|
||||
disabled={disabled}
|
||||
@ -30,4 +28,4 @@ export const Switcher = () => (({ disabled, checked, onChange, name, children }
|
||||
{children}
|
||||
</Switch>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user