File size: 4,424 Bytes
c5e6743
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Sample project data - in a real app this would come from an API
const projects = [
    {
        id: 1,
        title: "E-Commerce Platform",
        description: "A full-featured online shopping experience with payment integration.",
        image: "http://static.photos/technology/640x360/1",
        tags: ["React", "Node.js", "MongoDB"],
        github: "#",
        demo: "#"
    },
    {
        id: 2,
        title: "Task Management App",
        description: "Productivity application for teams to manage projects and deadlines.",
        image: "http://static.photos/office/640x360/2",
        tags: ["Vue.js", "Firebase", "Tailwind"],
        github: "#",
        demo: "#"
    },
    {
        id: 3,
        title: "Weather Dashboard",
        description: "Real-time weather forecasting with interactive maps and alerts.",
        image: "http://static.photos/nature/640x360/3",
        tags: ["JavaScript", "API", "Chart.js"],
        github: "#",
        demo: "#"
    },
    {
        id: 4,
        title: "Fitness Tracker",
        description: "Mobile-first application for tracking workouts and nutrition.",
        image: "http://static.photos/people/640x360/4",
        tags: ["React Native", "Redux", "GraphQL"],
        github: "#",
        demo: "#"
    },
    {
        id: 5,
        title: "Portfolio Website",
        description: "Responsive portfolio showcasing design and development work.",
        image: "http://static.photos/workspace/640x360/5",
        tags: ["HTML", "CSS", "JavaScript"],
        github: "#",
        demo: "#"
    },
    {
        id: 6,
        title: "Recipe Finder",
        description: "Search and save recipes from around the world with dietary filters.",
        image: "http://static.photos/food/640x360/6",
        tags: ["Angular", "Express", "PostgreSQL"],
        github: "#",
        demo: "#"
    }
];

// Function to render projects
function renderProjects() {
    const container = document.getElementById('projects-container');
    
    projects.forEach((project, index) => {
        const projectCard = document.createElement('div');
        projectCard.className = 'project-card animate-fade-in';
        projectCard.style.animationDelay = `${index * 0.1}s`;
        
        projectCard.innerHTML = `
            <img src="${project.image}" alt="${project.title}" class="project-image">
            <div class="p-6">
                <h4 class="text-xl font-bold mb-2 project-title">${project.title}</h4>
                <p class="text-gray-600 mb-4">${project.description}</p>
                <div class="flex flex-wrap gap-2 mb-4">
                    ${project.tags.map(tag => `<span class="project-tag text-xs px-3 py-1 rounded-full">${tag}</span>`).join('')}
                </div>
                <div class="flex justify-between">
                    <a href="${project.github}" class="text-indigo-600 hover:text-indigo-800 flex items-center">
                        <i data-feather="github" class="mr-1"></i> Code
                    </a>
                    <a href="${project.demo}" class="text-indigo-600 hover:text-indigo-800 flex items-center">
                        <i data-feather="external-link" class="mr-1"></i> Demo
                    </a>
                </div>
            </div>
        `;
        
        container.appendChild(projectCard);
    });
    
    // Re-initialize Feather icons after adding new elements
    feather.replace();
}

// Initialize the page
document.addEventListener('DOMContentLoaded', () => {
    renderProjects();
    
    // Theme toggle functionality
    const themeToggle = document.createElement('button');
    themeToggle.className = 'fixed bottom-6 right-6 bg-indigo-600 text-white p-3 rounded-full shadow-lg hover:bg-indigo-700 transition';
    themeToggle.innerHTML = '<i data-feather="moon"></i>';
    themeToggle.addEventListener('click', toggleTheme);
    document.body.appendChild(themeToggle);
    
    // Initialize Feather icons
    feather.replace();
});

// Theme toggle function
function toggleTheme() {
    document.body.classList.toggle('dark-mode');
    const isDarkMode = document.body.classList.contains('dark-mode');
    
    // Update icon
    const themeToggle = document.querySelector('.fixed.bottom-6.right-6');
    themeToggle.innerHTML = isDarkMode ? 
        '<i data-feather="sun"></i>' : 
        '<i data-feather="moon"></i>';
    
    feather.replace();
}