Skip to content

Commit

Permalink
Merge pull request #1 from NKkrisz/Remake
Browse files Browse the repository at this point in the history
Make Portfolio Work Again
  • Loading branch information
NKkrisz authored Feb 28, 2024
2 parents a263861 + 9c884bb commit ef1479f
Show file tree
Hide file tree
Showing 17 changed files with 233 additions and 259 deletions.
32 changes: 0 additions & 32 deletions components/changePage.js

This file was deleted.

19 changes: 0 additions & 19 deletions components/footer.js

This file was deleted.

32 changes: 0 additions & 32 deletions components/navbar.js

This file was deleted.

42 changes: 0 additions & 42 deletions functions/home.js

This file was deleted.

Binary file added img/projects/HomeLab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 27 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,37 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NKkrisz</title>
<link rel="stylesheet" href="style.css">
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>👨‍💻</text></svg>">
<link rel="stylesheet" href="style/main.css">
<link rel="stylesheet" href="style/navbar.css">
<link rel="stylesheet" href="style/footer.css">
<link rel="stylesheet" href="style/home.css">
</head>
<body>
<script type="module" src="components/navbar.js"></script>
<nav>
<h3>NKkrisz</h3>
<ul>
<li><a href="#" onclick="changePage('Home')">Home</a></li>
<li><a href="#" onclick="changePage('Projects')">Projects</a></li>
<li><a href="#" onclick="changePage('Contact')">Contact</a></li>
</ul>
</nav>

<div class="container"></div>
<main id="container"></main>

<script src="components/footer.js"></script>
<footer>
<ul>
<li>Socials:</li>
<li><a target="_blank" href="https://github.com/NKkrisz"><img src="img/icons/github.svg" alt="Github"></a></li>
<li><a target="_blank" href="https://www.reddit.com/user/NKkrisz"><img src="img/icons/reddit.svg" alt="Reddit"></a></li>
<li><a target="_blank" href="https://x.com/nkkrisz"><img src="img/icons/x.svg" alt="X"></a></li>
</ul>
<p>Icons made by: <a href="https://icons8.com/">Icons8</a></p>
</footer>

<script type="module">
import { changePage } from './scripts/navigator.js';
changePage("Home");
</script>
</body>
</html>
1 change: 0 additions & 1 deletion pages/contact.html

This file was deleted.

37 changes: 11 additions & 26 deletions pages/home.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
<div id="introduction">
<header id="introduction">
<h1>Hello, I'm NKkrisz</h1>
<p>a web developer, self host/open source enthusiast and gamer</p>
</div>
<hr>
<h2>My Projects</h2>
<div id="projects">
<div>
<label for="web_projects">Web Projects:</label>
<ul id="web_projects"></ul>
</div>
<div>
<label for="other_projects">Other Projects:</label>
<ul id="other_projects"></ul>
</div>
<div id="previewDiv">
<img id="preview" src="" alt="">
<label id="previewLabel" for="preview"></label>
</div>
</div>
<hr>
<div id="learning">
<h2>I'm currently learning:</h2>
<p>I am currently interested in how networks work, devops-like stuff and fundamentals of web development.
I also have a server rack at home which I will probably make a blog/project website about.
</p>
</div>
<p>an 18 year old who <i>eats and breathes</i> tech</p>
</header>
<section id="bestProjects">
<h2>My Best Projects</h2>
<div></div>
</section>
<section id="interests">
<h2>Current Interests</h2>
<div id="things">Work in progress...</div>
</section>
1 change: 0 additions & 1 deletion pages/projects.html

This file was deleted.

1 change: 1 addition & 0 deletions scripts/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const bestProjects = ["HomeLab", "Etch-a-Sketch", "google-homepage"]
19 changes: 19 additions & 0 deletions scripts/navigator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { requestRepos } from "./projects.js";
import { bestProjects } from "./home.js";

async function changePage(page) {
// This abomination is necessary because of the way GitHub Pages handles File Structure/Paths
// It doesn't work when developing with Live Server
page = page.toLowerCase();
const URL = window.location.href;
const response = await fetch(URL.includes("github") ? `/portfolio/pages/${page}.html` : `pages/${page}.html`);

const content = await response.text();
document.querySelector("#container").innerHTML = content;

if(page == "home"){
requestRepos(bestProjects);
}
}

export { changePage };
63 changes: 63 additions & 0 deletions scripts/projects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
async function requestRepos(bestProjects = false) {
const response = await fetch(`https://api.github.com/users/nkkrisz/repos`);
const repos = await response.json();
if(bestProjects){
bestProjects = bestProjects.map(project => project.toLowerCase());
for (let repo of repos) {
if(bestProjects.includes(repo.name.toLowerCase())){
console.log(repo.name);
const figure = document.createElement("figure");
const h3 = document.createElement("h3");
const image = document.createElement("img");
const figcaption = document.createElement("figcaption");

h3.innerText = repo.name;
image.src = `img/projects/${repo.name}.png`;
image.alt = repo.name;
figcaption.innerText = repo.description ? repo.description : "No description available";

figure.appendChild(h3);
figure.appendChild(image);
figure.appendChild(figcaption);
figure.classList.add("project");

document.querySelector("#bestProjects div").appendChild(figure);
}
}
} else {
for (let repo of repos) {
//Skip forks for now...
if(repo.fork == true) continue;

const li = document.createElement('li');
const a = document.createElement('a');

if(repo.has_pages == true){
a.href = `https://nkkrisz.github.io/${repo.name}/`;
a.innerText = repo.name;
a.target = "_blank"
li.appendChild(a);
document.querySelector("#web_projects").appendChild(li);

web_projects[repo.name] = repo;

li.addEventListener("mouseover", () => {
(repo.name !== "portfolio") ? document.querySelector("#preview").src = `img/projects/${repo.name}.png` : document.querySelector("#preview").src = null;
document.querySelector("#previewLabel").innerText = repo.description ? repo.description : "No description available";
});

} else {
a.href = repo.html_url;
a.innerText = repo.name;
a.target = "_blank"
li.appendChild(a);
document.querySelector("#other_projects").appendChild(li);

other_projects[repo.name] = repo;
}

};
}
};

export { requestRepos };
Loading

0 comments on commit ef1479f

Please sign in to comment.