import { useState } from 'react';
import { FileEdit, Download, ChevronRight, Check, ArrowLeft, Eye, User, Briefcase, GraduationCap, Award } from 'lucide-react';
export default function CVMaker() {
const [currentView, setCurrentView] = useState('landing'); // 'landing', 'templates', 'editor'
const [selectedTemplate, setSelectedTemplate] = useState(null);
const [previewTemplate, setPreviewTemplate] = useState(null); // Add this state
const [cvData, setCvData] = useState({
personalInfo: {
fullName: '',
title: '',
email: '',
phone: '',
profileImage: '' // Added for profile image
},
summary: '',
experience: [
{
id: 1,
title: '',
company: '',
description: ''
}
],
education: [
{
id: 1,
degree: '',
school: '',
year: ''
}
],
skills: ['']
});
const templates = [
{
id: 1,
name: "Professional",
description: "Clean and minimal design perfect for any industry",
image: "https://images.pexels.com/photos/3771807/pexels-photo-3771807.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2",
color: "blue",
preview: (data) => (
{data.personalInfo.fullName || "Your Name"}
{data.personalInfo.title || "Professional Title"}
{data.personalInfo.email || "email@example.com"}
{data.personalInfo.phone || "+1 234 567 890"}
Professional Summary
{data.summary || "Your professional summary goes here..."}
)
},
{
id: 2,
name: "Creative",
description: "Modern and bold layout for creative professionals",
image: "https://images.pexels.com/photos/3771823/pexels-photo-3771823.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2",
color: "purple",
preview: (data) => (
{data.personalInfo.fullName || "Your Name"}
{data.personalInfo.title || "Professional Title"}
{data.personalInfo.email || "email@example.com"}
{data.personalInfo.phone || "+1 234 567 890"}
About Me
{data.summary || "Your professional summary goes here..."}
)
},
{
id: 3,
name: "Executive",
description: "Sophisticated design for senior positions",
image: "https://images.pexels.com/photos/3771815/pexels-photo-3771815.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2",
color: "gray",
preview: (data) => (
{data.personalInfo.fullName || "Your Name"}
{data.personalInfo.title || "Professional Title"}
{data.personalInfo.email || "email@example.com"}
{data.personalInfo.phone || "+1 234 567 890"}
Executive Summary
{data.summary || "Your professional summary goes here..."}
)
}
];
const handleInputChange = (section, field, value, index = null) => {
setCvData(prev => {
if (index !== null) {
const newSection = [...prev[section]];
newSection[index] = { ...newSection[index], [field]: value };
return { ...prev, [section]: newSection };
}
return {
...prev,
[section]: typeof prev[section] === 'object' && !Array.isArray(prev[section])
? { ...prev[section], [field]: value }
: value
};
});
};
const addListItem = (section) => {
setCvData(prev => ({
...prev,
[section]: [...prev[section], {
id: prev[section].length + 1,
title: '',
company: '',
description: ''
}]
}));
};
const handleDownloadPDF = () => {
// Here you would implement actual PDF generation
alert('Downloading your CV...');
};
// Landing Page Component
const LandingPage = () => (
{/* Updated title to include special offer */}
Create Your Professional CV in Minutes
Choose from our professionally designed templates and customize your CV with our easy-to-use editor.
);
// Template Selection Component with Live Preview
const TemplateSelection = () => (
Choose Your Template
Select from our professionally designed templates to get started
{templates.map((template) => (
{/* Template Preview Image */}
{/* Template Info */}
{template.name}
{template.description}
))}
{/* Live Preview Modal */}
{previewTemplate && (
{previewTemplate.name} Template
{previewTemplate.preview(cvData)}
)}
);
// CV Editor Component
const CVEditor = () => (
Professional Summary
{/* Education Section */}
Education
{cvData.education.map((edu, index) => (
handleInputChange('education', 'degree', e.target.value, index)}
className="w-full p-2 border rounded-lg mb-2"
/>
handleInputChange('education', 'school', e.target.value, index)}
className="w-full p-2 border rounded-lg mb-2"
/>
handleInputChange('education', 'year', e.target.value, index)}
className="w-full p-2 border rounded-lg mb-2"
/>
))}
{/* Skills Section */}
Skills
{cvData.skills.map((skill, index) => (
{
const newSkills = [...cvData.skills];
newSkills[index] = e.target.value;
setCvData({ ...cvData, skills: newSkills });
}}
className="w-full p-2 border rounded-lg"
/>
))}
);
return (
{currentView === 'landing' &&
}
{currentView === 'templates' &&
}
{currentView === 'editor' &&
}
);
}