Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/login-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { IconLogo } from '@/components/ui/icons'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'

import { PasswordInput } from './ui/password-input'

export function LoginForm({
className,
...props
Expand Down Expand Up @@ -129,7 +131,7 @@ export function LoginForm({
Forgot password?
</Link>
</div>
<Input
<PasswordInput
id="password"
type="password"
Comment on lines +134 to 136
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.

placeholder="********"
Expand Down
6 changes: 3 additions & 3 deletions components/sign-up-form.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use client'

import { useState } from 'react'
import Link from 'next/link'
import { useRouter } from 'next/navigation'
Expand All @@ -18,6 +17,7 @@ import {
import { IconLogo } from '@/components/ui/icons'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { PasswordInput } from '@/components/ui/password-input'

export function SignUpForm({
className,
Expand Down Expand Up @@ -92,7 +92,7 @@ export function SignUpForm({
<div className="flex items-center">
<Label htmlFor="password">Password</Label>
</div>
<Input
<PasswordInput
id="password"
type="password"
placeholder="********"
Expand All @@ -105,7 +105,7 @@ export function SignUpForm({
<div className="flex items-center">
<Label htmlFor="repeat-password">Repeat Password</Label>
</div>
<Input
<PasswordInput
id="repeat-password"
type="password"
Comment on lines +108 to 110
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.

placeholder="********"
Expand Down
41 changes: 41 additions & 0 deletions components/ui/password-input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import * as React from 'react'
import { useState } from 'react'

import { Eye, EyeOff } from 'lucide-react'

import { Input, InputProps } from '@/components/ui/input'

import { Button } from './button'

const PasswordInput = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type = 'password', ...props }, ref) => {
const [showPassword, setShowPassword] = useState(false)
return (
<div className="relative flex">
<Input
type={showPassword ? 'text' : type}
className={className}
ref={ref}
{...props}
/>
<Button
type="button"
variant="ghost"
size="icon"
className="h-full px-3 py-2 hover:bg-transparent absolute right-0 flex items-center justify-center"
onClick={() => setShowPassword(!showPassword)}
>
{showPassword ? (
<EyeOff className="h-4 w-4" />
) : (
<Eye className="h-4 w-4" />
)}
</Button>
</div>
)
}
)

PasswordInput.displayName = 'PasswordInput'

export { PasswordInput }