@@ -55,9 +55,17 @@ const { frontmatter } = Astro.props;
5555 </div >
5656 </a >
5757 </section >
58- <section class =" prose max-w-6xl prose-img:border-0" >
59- <br >
58+ <section id =" cards" class =" grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mt-10" >
59+ <div class =" card-content card border-skin-line" >
60+ <div id =" unsplash-stats" >
61+ <h2 class =" text-lg text-skin-accent font-medium" >My Unsplash Stats</h2 >
62+ <p id =" downloads" >Downloads: </p >
63+ <p id =" views" >Views: </p >
64+ <p id =" likes" >Likes: </p >
65+ </div >
66+ </div >
6067 </section >
68+ <br >
6169 <section >
6270 <div style =" display: flex; justify-content: center; max-width: 100%;" >
6371 <iframe width =" 100%" height =" 337" seamless frameborder =" 0" src =" https://docs.google.com/spreadsheets/d/e/2PACX-1vTu8BIkLoeldqgLyVgPxmw-9fmOMu76TNv04y2OsG708ABJIJ7HLaZc234kmHDLz_g3zhjMNY3TKVqa/pubchart?oid=2021333611&format=interactive" ></iframe >
@@ -109,4 +117,32 @@ const { frontmatter } = Astro.props;
109117 --tw-text-opacity: 1;
110118 color: rgba(var(--color-accent), var(--tw-text-opacity));
111119 }
112- </style >
120+ </style >
121+
122+ <script >
123+ const username = 'william_vdg';
124+ require('dotenv').config();
125+ const accessKey = process.env.UNSPLASH_ACCESS_KEY;
126+
127+ fetch(`https://api.unsplash.com/users/${username}/statistics`, {
128+ headers: {
129+ 'Authorization': `Client-ID ${accessKey}`
130+ }
131+ })
132+ .then(response => response.json())
133+ .then(data => {
134+ const downloads = data.downloads?.total || 0;
135+ const views = data.views?.total || 0;
136+ const likes = data.likes?.total || 0;
137+
138+ document.getElementById('downloads').textContent = `Downloads: ${downloads}`;
139+ document.getElementById('views').textContent = `Views: ${views}`;
140+ document.getElementById('likes').textContent = `Likes: ${likes}`;
141+ })
142+ .catch(error => console.error('Error fetching user stats:', error));
143+
144+ </script >
145+ <script >
146+
147+
148+ </script >
0 commit comments