Skip to content

Commit fff5264

Browse files
committed
refactor(image-viewer): Simplify metadata display and improve layout
- Streamlined the rendering of image metadata, consolidating conditions and reducing redundancy. - Enhanced visibility of animated metadata by ensuring consistent formatting and layout adjustments. - Removed unnecessary elements for a cleaner presentation on both small and large screens.
1 parent e08b4a1 commit fff5264

1 file changed

Lines changed: 22 additions & 72 deletions

File tree

src/components/ImageViewer.tsx

Lines changed: 22 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -435,42 +435,32 @@ export function ImageViewer({
435435
)}
436436

437437
<div className="absolute bottom-4 left-0 right-0 flex flex-col items-center gap-2 z-50 px-4">
438-
<div className="hidden sm:flex flex-col items-start gap-1">
439-
<div className="flex items-center justify-start gap-2 rounded-md px-4 py-2 text-sm min-h-6">
440-
{metadata ? (
441-
<>
442-
{metadata.animatedSize ? (
443-
<span className="opacity-80">
444-
ORIGINAL: {metadata.width} × {metadata.height}px
445-
</span>
446-
) : (
447-
<span className="opacity-80">
448-
{metadata.width} × {metadata.height}px
449-
</span>
450-
)}
438+
<div className="flex flex-col items-start text-sm min-h-6 opacity-80">
439+
{metadata ? (
440+
<>
441+
<span>
442+
{metadata.animatedSize && <>ORIGINAL: </>}
443+
<>
444+
{metadata.width} × {metadata.height}px
445+
</>
451446
{metadata.fileSize && (
452-
<span className="opacity-80">
453-
· {formatFileSize(metadata.fileSize)}
454-
</span>
447+
<> · {formatFileSize(metadata.fileSize)}</>
455448
)}
456-
{metadata.format && (
457-
<span className="opacity-80">· {metadata.format}</span>
458-
)}
459-
</>
460-
) : (
461-
<span className="invisible opacity-0">0 × 0px</span>
462-
)}
463-
</div>
464-
{metadata?.animatedSize && (
465-
<div className="flex items-center justify-start gap-2 rounded-md px-4 py-2 text-sm min-h-6">
466-
<span className="opacity-80">
467-
ANIMATED: {metadata.animatedSize.width} ×{' '}
468-
{metadata.animatedSize.height}px
449+
{metadata.format && <>· {metadata.format}</>}
469450
</span>
470-
{metadata.interpolate === true && (
471-
<span className="opacity-80">· interpolate</span>
451+
</>
452+
) : (
453+
<span className="invisible opacity-0">0 × 0px</span>
454+
)}
455+
{metadata?.animatedSize && (
456+
<span>
457+
ANIMATED: {metadata.animatedSize.width} ×{' '}
458+
{metadata.animatedSize.height}px
459+
{metadata.fileSize && (
460+
<> · {formatFileSize(metadata.fileSize)}</>
472461
)}
473-
</div>
462+
{metadata.interpolate === true && <>· INTERPOLATE</>}
463+
</span>
474464
)}
475465
</div>
476466
<div
@@ -528,46 +518,6 @@ export function ImageViewer({
528518
</Button>
529519
</div>
530520
<div className="flex flex-col items-center gap-2 sm:hidden w-full">
531-
<div className="flex flex-col items-start gap-1 w-full">
532-
<div className="flex items-center justify-start gap-2 rounded-md px-3 py-1.5 text-base min-h-7 w-full">
533-
{metadata ? (
534-
<>
535-
{metadata.animatedSize ? (
536-
<span className="opacity-80">
537-
ORIGINAL: {metadata.width}×{metadata.height}px
538-
</span>
539-
) : (
540-
<span className="opacity-80">
541-
{metadata.width}×{metadata.height}px
542-
</span>
543-
)}
544-
{metadata.fileSize && (
545-
<span className="opacity-80">
546-
· {formatFileSize(metadata.fileSize)}
547-
</span>
548-
)}
549-
{metadata.format && (
550-
<span className="opacity-80">
551-
· {metadata.format}
552-
</span>
553-
)}
554-
</>
555-
) : (
556-
<span className="invisible opacity-0">0×0px</span>
557-
)}
558-
</div>
559-
{metadata?.animatedSize && (
560-
<div className="flex items-center justify-start gap-2 rounded-md px-3 py-1.5 text-xs min-h-6 w-full">
561-
<span className="opacity-80">
562-
ANIMATED: {metadata.animatedSize.width}×
563-
{metadata.animatedSize.height}px
564-
</span>
565-
{metadata.interpolate === true && (
566-
<span className="opacity-80">· interpolate</span>
567-
)}
568-
</div>
569-
)}
570-
</div>
571521
<div className="flex items-center gap-4 w-full">
572522
{hasPrevious && (
573523
<Button

0 commit comments

Comments
 (0)