Skip to content

Commit 1863245

Browse files
authored
API Key Field Enhancement: Replaced Show/Hide button with Eye ReactIcons (#579)
* replaced Show/Hide button with Eye ReactIcons * replaced Button with IconButton component
1 parent 70181df commit 1863245

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/components/PasswordInput.tsx

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { Button, Input, InputGroup, InputRightElement } from "@chakra-ui/react";
2-
import { type ComponentPropsWithRef, useState } from "react";
1+
import { useState, type ComponentPropsWithRef } from "react";
2+
import { Input, InputGroup, InputRightElement, IconButton } from "@chakra-ui/react";
3+
import { IoMdEye, IoMdEyeOff } from "react-icons/io";
34

45
type PasswordInputProps = ComponentPropsWithRef<typeof Input> & {
56
buttonSize?: "lg" | "md" | "sm" | "xs";
@@ -27,9 +28,15 @@ function PasswordInput({
2728
type={show ? "text" : "password"}
2829
/>
2930
<InputRightElement width={paddingRight}>
30-
<Button variant="ghost" h="1.75rem" size={buttonSize} onClick={() => setShow(!show)}>
31-
{show ? "Hide" : "Show"}
32-
</Button>
31+
<IconButton
32+
variant="ghost"
33+
h="1.75rem"
34+
size={buttonSize}
35+
icon={show ? <IoMdEyeOff /> : <IoMdEye />}
36+
onClick={() => setShow(!show)}
37+
aria-label={show ? "Hide" : "Show"}
38+
title={show ? "Hide" : "Show"}
39+
/>
3340
</InputRightElement>
3441
</InputGroup>
3542
);

0 commit comments

Comments
 (0)