import React, { useState } from 'react'
function ScreenshotViewer({ screenshots, url }) {
const [selectedViewport, setSelectedViewport] = useState(
Object.keys(screenshots)[0] || 'desktop'
)
const viewportLabels = {
desktop: 'Desktop',
tablet: 'Tablet',
mobile: 'Mobile'
}
const viewportIcons = {
desktop: '🖥️',
tablet: '📱',
mobile: '📱'
}
if (!screenshots || Object.keys(screenshots).length === 0) {
return (
)
}
const currentScreenshot = screenshots[selectedViewport]
return (
{/* Viewport Selector */}
Website Screenshots
{Object.keys(screenshots).map(viewport => (
))}
{/* Screenshot Display */}
{currentScreenshot && (
{viewportLabels[selectedViewport]} View
{currentScreenshot.width} × {currentScreenshot.height} pixels
Download
{/* Screenshot Image */}
{/* Screenshot Info */}
Screenshot Details
Viewport:
{viewportLabels[selectedViewport]}
Dimensions:
{currentScreenshot.width} × {currentScreenshot.height}
File Size:
{(currentScreenshot.fileSize / 1024).toFixed(1)} KB
)}
{/* Comparison View */}
{Object.keys(screenshots).length > 1 && (
Responsive Comparison
{Object.entries(screenshots).map(([viewport, screenshot]) => (
{viewportIcons[viewport]} {viewportLabels[viewport]}
{screenshot.width} × {screenshot.height}
))}
Responsive Design Notes
- • Compare how your website appears across different screen sizes
- • Look for layout issues, text readability, and navigation usability
- • Ensure important content and actions are accessible on all devices
- • Check that images and media scale appropriately
)}
)
}
export default ScreenshotViewer