fix lint, description of dialog

Signed-off-by: harkiratsm <multaniharry714@gmail.com>
This commit is contained in:
harkiratsm
2023-12-29 22:11:44 +05:30
parent 72a7dc6c05
commit 53c570151f
2 changed files with 96 additions and 91 deletions

View File

@ -1,50 +1,55 @@
import React from 'react';
import { Button } from './button';
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogDescription,
DialogFooter,
} from './dialog';
import { Input } from './input';
import { Button } from './button';
DialogHeader,
DialogTitle,
} from './dialog';
import { Input } from './input';
type PasswordDialogProps = {
open: boolean;
onOpenChange: (_open: boolean) => void;
setPassword: (_password: string) => void;
handleSubmit: () => void;
onPasswordSubmit: () => void;
isError?: boolean;
}
};
export const PasswordDialog = ({ open, onOpenChange, handleSubmit, isError, setPassword }: PasswordDialogProps) => {
export const PasswordDialog = ({
open,
onOpenChange,
onPasswordSubmit,
isError,
setPassword,
}: PasswordDialogProps) => {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle>Password Required</DialogTitle>
<DialogDescription>
{isError ? (
<span className="text-red-500">Incorrect password. Please try again.</span>
) : (
<span className="text-muted-foreground">
This document is password protected. Please enter the password to view the document.
</span>
)}
<DialogDescription className="text-muted-foreground">
This document is password protected. Please enter the password to view the document.
</DialogDescription>
</DialogHeader>
<DialogFooter className="flex w-full items-center justify-center gap-4">
<Input
type="password"
className="bg-background mt-1.5"
placeholder='Enter password'
placeholder="Enter password"
onChange={(e) => setPassword(e.target.value)}
autoComplete="off"
/>
<Button onClick={handleSubmit}>Submit</Button>
<Button onClick={onPasswordSubmit}>Submit</Button>
</DialogFooter>
{isError && (
<span className="text-xs text-red-500">
The password you entered is incorrect. Please try again.
</span>
)}
</DialogContent>
</Dialog>
);