-
Notifications
You must be signed in to change notification settings - Fork 339
add show/hide password feature in login and registration form #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@msamgan good idea ! I think the InputGroup component would be more appropriate. |
Yes, but a reusable component would be better. import { EyeClosedIcon, EyeIcon } from 'lucide-react';
import * as React from 'react';
import {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupInput
} from '@/components/ui/input-group';
function PasswordInput(
props: Omit<React.ComponentProps<typeof InputGroupInput>, 'type'>
) {
const [type, setType] = React.useState<'password' | 'text'>('password');
return (
<InputGroup>
<InputGroupInput type={type} {...props} />
<InputGroupAddon align="inline-end">
<InputGroupButton
size="icon-xs"
onClick={() => {
setType(value => {
return value === 'password' ? 'text' : 'password';
});
}}
>
{type === 'password' ? <EyeClosedIcon /> : <EyeIcon />}
</InputGroupButton>
</InputGroupAddon>
</InputGroup>
);
}
export { PasswordInput }; |
|
Hey there @msamgan, thanks for the contribution! 💪 |
WendellAdriel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check my comment above on creating a reusable component for this
Yes, this is good Instead of modifying an existing component, I had also created a PasswordInput component in my project. |
I will make the updates on this weekend. |
No description provided.