Skip to content

Conversation

vishv96
Copy link
Contributor

@vishv96 vishv96 commented Aug 23, 2025

Summary

This pull request introduces a PasswordInput component with a visibility toggle to improve the usability of password fields.

Implementation

  • A new, self-contained PasswordInput component has been created.
  • This component wraps the existing Input component and adds an eye icon button to toggle the password's visibility.
  • The base Input component remains unchanged, and the PasswordInput handles all the logic for the visibility toggle.
  • The LoginForm and SignUpForm have been updated to use the new PasswordInput component.
Screenshot 2025-08-23 at 9 09 22 AM Screenshot 2025-08-23 at 9 09 31 AM

Adds a visibility toggle button to the Input component when the type is "password".

This allows users to show and hide the password they are entering, improving usability and reducing errors.

The implementation uses an eye icon button that toggles the input type between "text" and "password".
Copy link

vercel bot commented Aug 23, 2025

@vishv96 is attempting to deploy a commit to the morphic Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Owner

@miurla miurla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! While the password visibility toggle is a valuable UX improvement, modifying the base Input component with useState converts it to a Client Component, breaking Server Component compatibility throughout the codebase.

I recommend creating a dedicated PasswordInput component instead (e.g., components/ui/password-input.tsx) that wraps the existing Input. This would make it an opt-in feature without breaking changes. Also, you can import Eye and EyeOff from 'lucide-react' directly in the new component rather than adding them to icons.tsx.

Would you be willing to refactor this approach?

@vishv96
Copy link
Contributor Author

vishv96 commented Aug 24, 2025

Thank you for your contribution! While the password visibility toggle is a valuable UX improvement, modifying the base Input component with useState converts it to a Client Component, breaking Server Component compatibility throughout the codebase.

I recommend creating a dedicated PasswordInput component instead (e.g., components/ui/password-input.tsx) that wraps the existing Input. This would make it an opt-in feature without breaking changes. Also, you can import Eye and EyeOff from 'lucide-react' directly in the new component rather than adding them to icons.tsx.

Would you be willing to refactor this approach?

Sure, I can work on that

This commit removes the password visibility toggle feature from the Input component.

The following changes are included:

- The eye icon button and its logic are removed from the Input component.

- The unused IconEye and IconEyeOff icons are removed from icons.tsx.
This commit introduces a new PasswordInput component to improve the user experience of password fields.

The PasswordInput component wraps the generic Input component and adds a button to toggle the visibility of the password.

The following changes are included:

- A new PasswordInput component is created in components/ui/password-input.tsx.

- The Input component in components/ui/input.tsx is updated to support a rightElement prop.

- The LoginForm and SignUpForm are updated to use the new PasswordInput component.
@vishv96 vishv96 requested a review from miurla August 25, 2025 12:19
@miurla miurla requested a review from Copilot August 26, 2025 01:09
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds password visibility toggle functionality to form inputs by creating a new PasswordInput component and updating the base Input component to support a rightElement prop. Users can now click an eye icon to show/hide their password while typing, improving usability and reducing input errors.

  • Creates a new PasswordInput component with eye/eye-off toggle icons
  • Modifies the Input component to support a rightElement prop for appending UI elements
  • Updates existing login and sign-up forms to use the new PasswordInput component

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
components/ui/password-input.tsx New component implementing password visibility toggle with eye icons
components/ui/input.tsx Added rightElement prop support and positioning wrapper
components/sign-up-form.tsx Replaced Input with PasswordInput for password fields
components/login-form.tsx Replaced Input with PasswordInput for password field

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

import { Button } from './button'

const PasswordInput = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type = 'password', rightElement, ...props }, ref) => {
Copy link
Preview

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The component accepts a rightElement prop but always overrides it with the toggle button. This prevents users from customizing the right element. Consider removing this prop from the interface or handling the case where a custom rightElement is provided.

Suggested change
({ className, type = 'password', rightElement, ...props }, ref) => {
({ className, type = 'password', ...props }, ref) => {

Copilot uses AI. Check for mistakes.

Comment on lines +108 to 110
<PasswordInput
id="repeat-password"
type="password"
Copy link
Preview

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type="password" prop is redundant since PasswordInput defaults to 'password' type. This prop should be removed for cleaner code.

Suggested change
<PasswordInput
id="repeat-password"
type="password"

Copilot uses AI. Check for mistakes.

Comment on lines +134 to 136
<PasswordInput
id="password"
type="password"
Copy link
Preview

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type="password" prop is redundant since PasswordInput defaults to 'password' type. This prop should be removed for cleaner code.

Suggested change
<PasswordInput
id="password"
type="password"

Copilot uses AI. Check for mistakes.

This commit refactors the password input functionality.

Instead of having a generic `rightElement` prop in the `Input` component, the logic for toggling password visibility is now fully encapsulated within the `PasswordInput` component. This improves component modularity and simplifies the `Input` component.
Copy link

vercel bot commented Aug 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
morphic Ready Ready Preview Comment Aug 28, 2025 5:24am

Copy link
Owner

@miurla miurla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing the feedback! The implementation looks good now.

The CI is currently failing. Could you please run:

  • bun run typecheck
  • bun lint
  • bun format

Once the CI passes, this is ready to merge.

Copy link
Owner

@miurla miurla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@miurla miurla merged commit 77c1b39 into miurla:main Aug 28, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants