Skip to content

Commit

Permalink
API Key Field Enhancement: Replaced Show/Hide button with Eye ReactIc…
Browse files Browse the repository at this point in the history
…ons (#579)

* replaced Show/Hide button with Eye ReactIcons

* replaced Button with IconButton component
  • Loading branch information
rjwignar committed Apr 12, 2024
1 parent 70181df commit 1863245
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/components/PasswordInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Button, Input, InputGroup, InputRightElement } from "@chakra-ui/react";
import { type ComponentPropsWithRef, useState } from "react";
import { useState, type ComponentPropsWithRef } from "react";
import { Input, InputGroup, InputRightElement, IconButton } from "@chakra-ui/react";
import { IoMdEye, IoMdEyeOff } from "react-icons/io";

type PasswordInputProps = ComponentPropsWithRef<typeof Input> & {
buttonSize?: "lg" | "md" | "sm" | "xs";
Expand Down Expand Up @@ -27,9 +28,15 @@ function PasswordInput({
type={show ? "text" : "password"}
/>
<InputRightElement width={paddingRight}>
<Button variant="ghost" h="1.75rem" size={buttonSize} onClick={() => setShow(!show)}>
{show ? "Hide" : "Show"}
</Button>
<IconButton
variant="ghost"
h="1.75rem"
size={buttonSize}
icon={show ? <IoMdEyeOff /> : <IoMdEye />}
onClick={() => setShow(!show)}
aria-label={show ? "Hide" : "Show"}
title={show ? "Hide" : "Show"}
/>
</InputRightElement>
</InputGroup>
);
Expand Down

0 comments on commit 1863245

Please sign in to comment.