dstpabuaran.com/resources/js/components/image-preview-modal.tsx
Yoga Pangestu 23cc327190 Refactor code for improved readability and consistency across multiple files
- Adjusted indentation and formatting in login, permissions, profile, and security pages for better readability.
- Enhanced the clarity of conditional statements and function calls in permissions and profile components.
- Updated type definitions in vite-env.d.ts for better code structure.
- Cleaned up array mapping syntax in ProductTest.php for consistency.
2026-08-01 10:14:47 +07:00

42 lines
993 B
TypeScript

import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog';
type ImagePreviewModalProps = {
open: boolean;
onOpenChange: (open: boolean) => void;
src: string | null;
title?: string;
alt?: string;
};
export function ImagePreviewModal({
open,
onOpenChange,
src,
title,
alt = 'Preview',
}: ImagePreviewModalProps) {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent showCloseButton>
{title && (
<DialogHeader>
<DialogTitle>{title}</DialogTitle>
</DialogHeader>
)}
{src && (
<img
src={src}
alt={alt}
className="max-h-[80vh] w-full rounded-lg object-contain"
/>
)}
</DialogContent>
</Dialog>
);
}