| import React from 'react'; |
| import { Download, Share2, RefreshCw } from 'lucide-react'; |
|
|
| interface ResultViewerProps { |
| originalImage: string; |
| resultImage: string | null; |
| isLoading: boolean; |
| } |
|
|
| export const ResultViewer: React.FC<ResultViewerProps> = ({ originalImage, resultImage, isLoading }) => { |
| if (!resultImage && !isLoading) return null; |
|
|
| return ( |
| <div className="w-full h-full flex flex-col"> |
| <div className="relative w-full aspect-[3/4] sm:aspect-square bg-stone-100 rounded-2xl overflow-hidden shadow-inner border border-stone-200"> |
| {isLoading ? ( |
| <div className="absolute inset-0 flex flex-col items-center justify-center bg-white/90 z-10"> |
| <div className="w-12 h-12 border-4 border-red-800 border-t-transparent rounded-full animate-spin mb-4"></div> |
| <p className="text-red-900 font-medium animate-pulse">正在量体裁衣 (Designing Hanfu)...</p> |
| <p className="text-stone-500 text-sm mt-2">AI is weaving the fabric of history</p> |
| </div> |
| ) : resultImage ? ( |
| <img |
| src={resultImage} |
| alt="Generated Hanfu" |
| className="w-full h-full object-cover animate-fade-in" |
| /> |
| ) : null} |
| </div> |
| |
| {resultImage && !isLoading && ( |
| <div className="flex gap-3 mt-4"> |
| <button |
| onClick={() => { |
| const link = document.createElement('a'); |
| link.href = resultImage; |
| link.download = 'hanfu-tryon.png'; |
| link.click(); |
| }} |
| className="flex-1 flex items-center justify-center gap-2 py-3 bg-stone-800 text-white rounded-xl hover:bg-stone-900 transition-colors" |
| > |
| <Download size={18} /> 保存图片 |
| </button> |
| </div> |
| )} |
| </div> |
| ); |
| }; |
|
|