import React, { useState } from 'react'; interface TitleSelectorProps { titleOptions: string[]; selectedTitle?: string; onTitleSelect: (title: string) => void; onCustomTitle?: (title: string) => void; } const TitleSelector: React.FC = ({ titleOptions, selectedTitle, onTitleSelect, onCustomTitle }) => { const [showCustomInput, setShowCustomInput] = useState(false); const [customTitle, setCustomTitle] = useState(''); const handleCustomTitleSubmit = () => { if (customTitle.trim() && onCustomTitle) { onCustomTitle(customTitle.trim()); setCustomTitle(''); setShowCustomInput(false); } }; return (

📝 Choose Your Blog Title

Select from AI-generated options or create your own custom title.

{/* AI-Generated Title Options */}

AI-Generated Options

{titleOptions.map((title, index) => (
onTitleSelect(title)} style={{ padding: '12px 16px', border: selectedTitle === title ? '2px solid #1976d2' : '1px solid #e0e0e0', borderRadius: '8px', cursor: 'pointer', backgroundColor: selectedTitle === title ? '#f0f8ff' : 'white', transition: 'all 0.2s ease', fontSize: '14px', color: '#333' }} onMouseEnter={(e) => { if (selectedTitle !== title) { e.currentTarget.style.backgroundColor = '#f8f9fa'; e.currentTarget.style.borderColor = '#1976d2'; } }} onMouseLeave={(e) => { if (selectedTitle !== title) { e.currentTarget.style.backgroundColor = 'white'; e.currentTarget.style.borderColor = '#e0e0e0'; } }} >
{selectedTitle === title && ( )} {title}
))}
{/* Custom Title Input */}

Custom Title

{!showCustomInput ? ( ) : (
setCustomTitle(e.target.value)} placeholder="Enter your custom title..." style={{ flex: 1, padding: '12px 16px', border: '1px solid #e0e0e0', borderRadius: '8px', fontSize: '14px', outline: 'none' }} onKeyPress={(e) => { if (e.key === 'Enter') { handleCustomTitleSubmit(); } }} autoFocus />
)}
{/* Title Tips */}
💡 Title Tips
  • Keep it under 60 characters for better SEO
  • Include your primary keyword naturally
  • Make it compelling and click-worthy
  • Consider your target audience
); }; export default TitleSelector;