From bf8b46622981a3e680462c25fe9e2c05adc9c5c9 Mon Sep 17 00:00:00 2001 From: Divyam Ahuja Date: Tue, 10 Nov 2026 02:02:31 +0530 Subject: [PATCH] UI enhancements: homepage de-duplication, copy code button, article links on projects, reading time --- assets/css/style.css | 125 ++++++++++++++++++++++++++++----- hugo.toml | 3 + layouts/_default/baseof.html | 28 ++++++++ layouts/_default/projects.html | 32 ++++----- layouts/_default/single.html | 2 + layouts/index.html | 87 ++++++++++------------- 6 files changed, 192 insertions(+), 85 deletions(-) diff --git a/assets/css/style.css b/assets/css/style.css index 519ac0a..d0f033d 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -220,6 +220,31 @@ img { } /* --- Section Headings --- */ +.section-title-bar { + display: flex; + align-items: center; + justify-content: space-between; + margin: 3rem 0 1.5rem; + gap: 1rem; +} + +.section-title-bar .section-heading { + margin: 0; + flex: 1; +} + +.section-link { + font-size: 0.85rem; + color: var(--accent-dim); + text-decoration: none; + white-space: nowrap; + transition: color var(--transition); +} + +.section-link:hover { + color: var(--fg-bright); +} + .section-heading { font-size: 1.2rem; color: var(--accent); @@ -585,6 +610,38 @@ pre code { margin: 0; } +.copy-code-btn { + position: absolute; + top: 0.5rem; + right: 0.5rem; + padding: 0.2rem 0.55rem; + font-family: var(--font-mono); + font-size: 0.72rem; + color: var(--fg-dim); + background: var(--bg); + border: 1px solid var(--border); + border-radius: 3px; + cursor: pointer; + opacity: 0; + transition: opacity var(--transition), color var(--transition), border-color var(--transition), background-color var(--transition); + z-index: 2; + user-select: none; +} + +pre:hover .copy-code-btn { + opacity: 1; +} + +.copy-code-btn:hover { + color: var(--fg-bright); + border-color: var(--accent); +} + +.copy-code-btn.copied { + color: #50fa7b; + border-color: #50fa7b; +} + /* --- Tables --- */ table { width: 100%; @@ -716,26 +773,70 @@ th { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 6px; - transition: border-color var(--transition), background-color var(--transition), transform var(--transition); + transition: border-color var(--transition), background-color var(--transition); color: var(--fg); - text-decoration: none; } .project-card:hover { - border-color: var(--accent); + border-color: var(--accent-dim); background: var(--bg-hover); - transform: translateX(4px); - color: var(--fg); } .project-card-inner { flex: 1; } +.project-card-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.75rem; + margin-bottom: 0.35rem; + flex-wrap: wrap; +} + .project-card-name { font-size: 1rem; + color: var(--fg-bright); + margin: 0; +} + +.project-card-name a { color: var(--accent); - margin: 0 0 0.3rem; + text-decoration: none; + transition: color var(--transition); +} + +.project-card-name a:hover { + color: var(--fg-bright); +} + +.project-arrow { + display: inline-block; + font-size: 0.85rem; + transition: transform var(--transition); +} + +.project-card-name a:hover .project-arrow { + transform: translate(2px, -2px); +} + +.project-article-link { + font-size: 0.72rem; + color: var(--accent); + background: var(--accent-glow); + border: 1px solid var(--accent-dim); + padding: 0.15rem 0.5rem; + border-radius: 3px; + text-decoration: none; + white-space: nowrap; + transition: background-color var(--transition), color var(--transition), border-color var(--transition); +} + +.project-article-link:hover { + background: var(--accent); + color: var(--bg); + border-color: var(--accent); } .project-card-desc { @@ -761,18 +862,6 @@ th { border: 1px solid var(--border); } -.project-card-arrow { - color: var(--fg-dim); - font-size: 1.2rem; - margin-left: 1rem; - transition: color var(--transition), transform var(--transition); -} - -.project-card:hover .project-card-arrow { - color: var(--accent); - transform: translateX(3px); -} - /* --- Resume Page --- */ .resume-page { max-width: 100%; diff --git a/hugo.toml b/hugo.toml index 76c3da9..4b42f7f 100644 --- a/hugo.toml +++ b/hugo.toml @@ -58,18 +58,21 @@ title = "Divyam Ahuja" [[params.projects]] name = "Homelab" url = "#" + article = "/posts/debugging-k8s-disk-pressure-homelab/" description = "Self-hosted high-availability infrastructure on Raspberry Pi 5" tags = ["Kubernetes", "WireGuard", "Rancher", "MetalLB"] [[params.projects]] name = "chip_eight.js" url = "https://github.com/ahujadivyam/chip_eight.js" + article = "/posts/i-built-a-chip8-emulator-in-javascript/" description = "A browser-based CHIP-8 virtual machine and interpreter written in vanilla JavaScript" tags = ["JavaScript", "Emulators", "Canvas", "WebAudio"] [[params.projects]] name = "snake_wasm" url = "https://github.com/ahujadivyam/snake_wasm" + article = "/posts/snake-game-in-cpp-and-webassembly/" description = "Classic Snake game in C++ using olcPixelGameEngine, compiled to WebAssembly via Emscripten" tags = ["C++", "WebAssembly", "Emscripten", "GameDev"] diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index e843ba6..60f8437 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -11,5 +11,33 @@ {{- partial "footer.html" . -}} + + diff --git a/layouts/_default/projects.html b/layouts/_default/projects.html index 6672b2a..5b615b8 100644 --- a/layouts/_default/projects.html +++ b/layouts/_default/projects.html @@ -1,13 +1,23 @@ {{ define "main" }}

Projects

-

Things I've built or contributed to.

+

Things I've built, contributed to, or run in production.

{{- range .Site.Params.projects }} - {{- if eq .url "#" }}
-

{{ .name }}

+
+

+ {{- if eq .url "#" -}} + {{ .name }} + {{- else -}} + {{ .name }} ↗ + {{- end -}} +

+ {{- with .article }} + writeup ↗ + {{- end }} +

{{ .description }}

{{- with .tags }}
@@ -18,22 +28,6 @@ {{- end }}
- {{- else }} - -
-

{{ .name }}

-

{{ .description }}

- {{- with .tags }} -
- {{- range . }} - {{ . }} - {{- end }} -
- {{- end }} -
- → -
- {{- end }} {{- end }}
{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 208e9d0..ef8b822 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -6,6 +6,8 @@ {{ .Site.Params.author | upper }} · + · + {{ .ReadingTime }} min read {{- with .Params.tags }} |