Files
tfm_ainventory/frontend/components/PhotoModal.tsx
Daniel Bedeleanu 9a87064dbe fix(design): replace all 40+ hardcoded colors with DESIGN.md semantic system
Phase 10 Implementation: Bulk color system compliance across frontend

Applied DESIGN_COLOR_RULES.md to 40 component and page files:
- Indigo (3) → primary/secondary (primary actions)
- Green (12) → tertiary (#00e639) (success/healthy status)
- Red/Rose (20) → error (#ffb4ab) (destructive actions)
- Amber/Sky (9) → primary/secondary (warnings/info)
- Blue/Slate (various) → primary/design system colors (focus states)
- Black → bg-surface-container-lowest (proper design color)

Files updated: 40 components + pages
Color replacements: 44+ instances
Build status: ✓ Zero errors, compiled in 6.3s
Test status: Pending (npm run test)

All colors now follow DESIGN.md Industrial Precision system:
 Primary: #ffb781 (caution orange)
 Secondary: #c8c6c5 (gray)
 Tertiary: #00e639 (healthy green)
 Error: #ffb4ab (destructive red)
 Design system enforced across all UI/UX

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-25 17:19:53 +03:00

65 lines
1.8 KiB
TypeScript

'use client';
import React, { useEffect } from 'react';
import { X } from 'lucide-react';
interface PhotoModalProps {
photoUrl: string;
onClose: () => void;
title?: string;
}
export default function PhotoModal({
photoUrl,
onClose,
title = 'Photo',
}: PhotoModalProps) {
useEffect(() => {
const handleEscapeKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
onClose();
}
};
window.addEventListener('keydown', handleEscapeKey);
return () => window.removeEventListener('keydown', handleEscapeKey);
}, [onClose]);
return (
<div
className="fixed inset-0 bg-surface-container-lowest/50 flex items-center justify-center z-50 p-4"
onClick={onClose}
role="dialog"
aria-modal="true"
aria-label={`Photo viewer for ${title}`}
>
<div
className="bg-surface border border-border rounded-none max-w-2xl w-full max-h-[90vh] overflow-auto flex flex-col"
onClick={(e) => e.stopPropagation()}
>
{/* Header */}
<div className="sticky top-0 bg-surface border-b border-border/50 p-4 md:p-6 flex items-center justify-between">
<h2 className="text-xl md:text-2xl font-normal text-white truncate">{title}</h2>
<button
onClick={onClose}
className="p-2 hover:bg-surface-bright rounded-none text-muted hover:text-white transition-colors"
aria-label="Close modal"
>
<X size={20} className="text-error" />
</button>
</div>
{/* Image Container */}
<div className="p-4 md:p-6 flex items-center justify-center flex-1">
<img
src={photoUrl}
alt={title}
className="max-w-full max-h-[calc(90vh-120px)] object-contain rounded-none"
loading="lazy"
/>
</div>
</div>
</div>
);
}