Skip to content

Commit

Permalink
all set
Browse files Browse the repository at this point in the history
  • Loading branch information
SH20RAJ authored Mar 24, 2024
1 parent 341564e commit 5cf3137
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/app/components/Card2.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,35 @@ const ProfileCard = () => {

const { avatar_url, name, bio, followers, public_repos, html_url } = userDetails;

let scriptdata = ` // Function to fetch repository details from GitHub API
async function fetchRepoDetails(username, repoName) {
const url = 'https://api.github.com/repos/'+username+'/'+repoName+'';
try {
const response = await fetch(url);
const data = await response.json();
return data;
} catch (error) {
console.error('Error fetching repository details:', error);
return null;
}
}
// Function to update the repository card with fetched repo details
async function updateRepoCard(username, repoName) {
const repoDetails = await fetchRepoDetails(username, repoName);
if (repoDetails) {
const { name, description, stargazers_count, forks_count, language } = repoDetails;
document.getElementById('description').textContent = description || '';
document.getElementById('stars').textContent = stargazers_count;
document.getElementById('forks').textContent = forks_count;
document.getElementById('language').textContent = language || 'N/A';
document.querySelector('.max-w-md').classList.add('animated-slide-in');
}
}
// Call the updateRepoCard function with the username and repository name
updateRepoCard('sh20raj', 'devart');
`;
return (
<>
<div className="max-w-md mx-auto bg-white shadow-lg rounded-lg overflow-hidden relative animated-slide-in">
Expand Down Expand Up @@ -94,6 +123,8 @@ const ProfileCard = () => {
</div>
</div>
</div>
<script dangerouslySetInnerHTML={{ __html: scriptdata }} />




Expand Down
2 changes: 2 additions & 0 deletions src/app/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@


export default () => {
{console.clear()}
return (
<footer>
<script>console.clear()</script>
<b>
@Blog<span style={{ color: "tomato" }}>X</span>{" "}
</b>{" "}
Expand Down

0 comments on commit 5cf3137

Please sign in to comment.