-
Notifications
You must be signed in to change notification settings - Fork 0
Replace contributor links with Projects page; add floating contributor profile icons #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ee10491
e94b1ba
6317f74
99966c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [ | ||
| { | ||
| "name": "Kiya Rose", | ||
| "url": "https://kiya.cat", | ||
| "avatar": "https://avatars.githubusercontent.com/u/75678535?v=4", | ||
| "label": "Kiya Rose — Portfolio" | ||
| }, | ||
| { | ||
| "name": "Krystal Rose", | ||
| "url": "https://enby.fun", | ||
| "avatar": "https://avatars.githubusercontent.com/u/32627918?v=4", | ||
| "label": "Krystal Rose — Website" | ||
| } | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,7 @@ | ||
| [ | ||
| { | ||
| "title": "Kiya Rose — Portfolio", | ||
| "url": "/kiya" | ||
| }, | ||
| { | ||
| "title": "Krystal Rose — Website", | ||
| "url": "/krystal" | ||
| "title": "Projects", | ||
| "url": "https://projects.sillylittle.tech", | ||
| "subtitle": "Explore our open-source projects" | ||
| } | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,10 @@ document.addEventListener('DOMContentLoaded', () => { | |
| debugLog('Calling renderLinks') | ||
| renderLinks('#linksContainer', 'links.json') | ||
|
|
||
| // Render contributor icons from contributors.json | ||
| debugLog('Calling renderContributors') | ||
| renderContributors('#contributorsContainer', 'contributors.json') | ||
|
|
||
| // Render footer from includes/footer.html | ||
| debugLog('Calling renderFooter') | ||
| renderFooter('#siteFooter', 'includes/footer.html') | ||
|
|
@@ -75,6 +79,47 @@ function renderLinks (containerSelector, jsonPath) { | |
| }) | ||
| } | ||
|
|
||
| /** | ||
| * Fetches a JSON file containing contributor data and renders round profile icon links. | ||
| * Each contributor object may have: { name, url, avatar, label } | ||
| */ | ||
| function renderContributors (containerSelector, jsonPath) { | ||
| const container = document.querySelector(containerSelector) | ||
| if (!container) return | ||
| debugLog(`renderContributors: fetching ${jsonPath}`) | ||
|
|
||
| fetch(jsonPath) | ||
| .then((res) => { | ||
| if (!res.ok) throw new Error(`Failed to load ${jsonPath}`) | ||
| return res.json() | ||
| }) | ||
| .then((contributors) => { | ||
| container.innerHTML = '' | ||
| debugLog(`renderContributors: got ${contributors.length} contributors`) | ||
|
|
||
| contributors.forEach((contributor) => { | ||
| const anchor = document.createElement('a') | ||
| anchor.className = 'contributor-icon' | ||
| anchor.href = contributor.url || '#' | ||
| anchor.target = '_blank' | ||
| anchor.rel = 'noopener noreferrer' | ||
| anchor.setAttribute('aria-label', contributor.label || contributor.name || contributor.url || 'Contributor') | ||
|
|
||
| const img = document.createElement('img') | ||
| img.src = contributor.avatar || '' | ||
| img.alt = contributor.name || '' | ||
|
|
||
|
Comment on lines
+108
to
+111
|
||
| anchor.appendChild(img) | ||
| container.appendChild(anchor) | ||
| }) | ||
| }) | ||
| .catch((err) => { | ||
| const msg = err?.message ?? 'unknown error' | ||
| console.error('Error rendering contributors:', err) | ||
| debugLog(`renderContributors error: ${msg}`) | ||
| }) | ||
|
Comment on lines
+116
to
+120
|
||
| } | ||
|
|
||
| /** | ||
| * Fetches an HTML file and injects its content into the target element. | ||
| * Falls back to the original static footer markup already in the page if the fetch fails. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,38 @@ footer.site-footer a { | |
| font-size: 14px; | ||
| } | ||
|
|
||
| /* Contributor profile icons — displayed above the links list in the right section */ | ||
| .contributor-icons { | ||
| display: flex; | ||
| flex-direction: row; | ||
| gap: 10px; | ||
| margin-bottom: 16px; | ||
| } | ||
|
Comment on lines
+161
to
+167
|
||
| .contributor-icon { | ||
| width: 44px; | ||
| height: 44px; | ||
| border-radius: 50%; | ||
| overflow: hidden; | ||
| border: 2px solid var(--border-color); | ||
| background: var(--card-bg); | ||
| display: block; | ||
| box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); | ||
| transition: | ||
| transform 0.18s ease, | ||
| box-shadow 0.18s ease; | ||
| text-decoration: none; | ||
| } | ||
| .contributor-icon:hover { | ||
| transform: scale(1.12); | ||
| box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2); | ||
| } | ||
| .contributor-icon img { | ||
| width: 100%; | ||
| height: 100%; | ||
| object-fit: cover; | ||
| display: block; | ||
| } | ||
|
|
||
| @media (max-width: 768px) { | ||
| .container { | ||
| grid-template-columns: 1fr; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renderContributorssetsanchor.hrefto'#'whencontributor.urlis missing but still forcestarget="_blank". This can open a useless blank tab (and#can also jump to the top if opened in-page). Prefer skipping entries without a valid URL, or only settingtarget/relwhen the URL is present and external.