-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (21 loc) · 1.02 KB
/
index.js
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
import { fetchJSON, renderProjects, fetchGitHubData } from './global.js';
const projects = await fetchJSON('https://andiigonzalez.github.io/portfolio/lib/projects.json');
console.log("Projects Retrieved:", projects);
const latestProjects = projects.slice(0, 3);
const projectsContainer = document.querySelector('.projects');
renderProjects(latestProjects, projectsContainer, 'h3');
console.log("Latest Projects:", latestProjects);
const githubData = await fetchGitHubData('andiigonzalez'); // Fetch data
const profileStats = document.querySelector('#profile-stats'); // Select HTML container
if (profileStats) {
profileStats.innerHTML = `
<p></p>
<h2>My GitHub Statistics: </h2>
<dl>
<dt>FOLLOWERS:</dt><dd>${githubData.followers}</dd>
<dt>FOLLOWING:</dt><dd>${githubData.following}</dd>
<dt>PUBLIC REPOS:</dt><dd>${githubData.public_repos}</dd>
<dt>PUBLIC GISTS:</dt><dd>${githubData.public_gists}</dd>
</dl>
`;
}