File size: 1,333 Bytes
1f36718
d51dbe5
 
 
 
1f36718
 
d51dbe5
 
 
 
 
2db1da7
1f36718
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

// Initialize tooltips
document.addEventListener('DOMContentLoaded', function() {
    // Any shared JavaScript functionality can go here
    console.log('The Ultimate Blank Canvas App is ready!');
    
    // Example: Add a simple fade-in animation to all pages
    document.body.style.opacity = '0';
    setTimeout(() => {
        document.body.style.transition = 'opacity 0.5s ease-in';
        document.body.style.opacity = '1';
    }, 100);

    // Load projects if on projects page
    if (window.location.pathname.includes('projects.html')) {
        loadProjects();
    }
});

async function loadProjects() {
    try {
        const response = await axios.get('https://jsonplaceholder.typicode.com/posts?_limit=6');
        const projectsContainer = document.getElementById('projects-container');
        projectsContainer.innerHTML = response.data.map(project => `
            <div class="bg-white p-4 rounded-lg shadow border hover:shadow-md transition">
                <h3 class="font-medium mb-2">${project.title}</h3>
                <p class="text-sm text-gray-600 mb-2">Created: ${new Date().toLocaleDateString()}</p>
                <a href="#" class="text-blue-600 text-sm">Open β†’</a>
            </div>
        `).join('');
    } catch (error) {
        console.error('Failed to load projects:', error);
    }
}