mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: simplify props
This commit is contained in:
@@ -3,14 +3,7 @@ import { EyeIcon, EyeOffIcon } from "lucide-react";
|
|||||||
import { Input, type InputProps } from "../ui/input";
|
import { Input, type InputProps } from "../ui/input";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
|
|
||||||
interface ToggleVisibilityInputProps extends InputProps {
|
export const ToggleVisibilityInput = ({ ...props }: InputProps) => {
|
||||||
value: string | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ToggleVisibilityInput = ({
|
|
||||||
value,
|
|
||||||
...props
|
|
||||||
}: ToggleVisibilityInputProps) => {
|
|
||||||
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
||||||
|
|
||||||
const togglePasswordVisibility = () => {
|
const togglePasswordVisibility = () => {
|
||||||
@@ -20,7 +13,7 @@ export const ToggleVisibilityInput = ({
|
|||||||
const inputType = isPasswordVisible ? "text" : "password";
|
const inputType = isPasswordVisible ? "text" : "password";
|
||||||
return (
|
return (
|
||||||
<div className="flex w-full items-center space-x-2">
|
<div className="flex w-full items-center space-x-2">
|
||||||
<Input value={value} type={inputType} {...props} />
|
<Input type={inputType} {...props} />
|
||||||
<Button onClick={togglePasswordVisibility} variant={"secondary"}>
|
<Button onClick={togglePasswordVisibility} variant={"secondary"}>
|
||||||
{inputType === "password" ? (
|
{inputType === "password" ? (
|
||||||
<EyeIcon className="size-4 text-muted-foreground" />
|
<EyeIcon className="size-4 text-muted-foreground" />
|
||||||
|
|||||||
Reference in New Issue
Block a user