Spaces:
Configuration error
Configuration error
| import React, { useState } from 'react'; | |
| interface SummaryResultProps { | |
| summary: string; | |
| } | |
| const SummaryResult: React.FC<SummaryResultProps> = ({ summary }) => { | |
| const [copied, setCopied] = useState(false); | |
| const handleCopy = () => { | |
| navigator.clipboard.writeText(summary); | |
| setCopied(true); | |
| setTimeout(() => setCopied(false), 2000); | |
| }; | |
| if (!summary) return null; | |
| return ( | |
| <div className="mt-8 animate-in fade-in slide-in-from-bottom-4 duration-500"> | |
| <div className="flex items-center justify-between mb-4"> | |
| <h2 className="text-lg font-semibold text-gray-800 flex items-center gap-2"> | |
| <svg className="w-5 h-5 text-indigo-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"> | |
| <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /> | |
| </svg> | |
| Summary | |
| </h2> | |
| <button | |
| onClick={handleCopy} | |
| className="text-sm flex items-center gap-1.5 font-medium text-indigo-600 hover:text-indigo-700 transition-colors px-3 py-1 rounded-md hover:bg-indigo-50" | |
| > | |
| {copied ? ( | |
| <> | |
| <svg className="w-4 h-4" fill="currentColor" viewBox="0 0 20 20"> | |
| <path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" /> | |
| </svg> | |
| Copied | |
| </> | |
| ) : ( | |
| <> | |
| <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> | |
| <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3" /> | |
| </svg> | |
| Copy Text | |
| </> | |
| )} | |
| </button> | |
| </div> | |
| <div className="bg-white border border-gray-200 rounded-xl p-6 shadow-sm"> | |
| <div className="prose prose-indigo max-w-none text-gray-700 leading-relaxed"> | |
| {summary} | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| }; | |
| export default SummaryResult; | |