Bunch of behavioral fixes

This commit is contained in:
Ian Keane 2026-08-26 13:09:47 -04:00
parent 3ce624089c
commit 30859c5e84
4 changed files with 183 additions and 86 deletions

View file

@ -18,16 +18,20 @@
;; ─── Individual cards (all become flat children of .columns) ──────────────────
;; Project card — optionally wraps in an anchor if url is set
(define (render-project proj)
`(div (@ (class "project-card"))
(div (@ (class "project-header"))
(span (@ (class "project-name")) ,(field proj 'name))
,(date-range (field proj 'date-start) (field proj 'date-end)))
(div (@ (class "project-summary"))
,(bullets (field proj 'summary-bullets)))
(div (@ (class "project-details"))
,(bullets (field proj 'detail-bullets)))
,(tech-list (field proj 'technologies))))
(let* ((url (field proj 'url))
(card `(div (@ (class ,(string-append "project-card" (if url " clickable" "")))
,@(if url `((onclick ,(string-append "window.open('" url "','_blank')"))) '()))
(div (@ (class "project-header"))
(span (@ (class "project-name")) ,(field proj 'name))
,(date-range (field proj 'date-start) (field proj 'date-end)))
(div (@ (class "project-summary"))
,(bullets (field proj 'summary-bullets)))
(div (@ (class "project-details"))
,(bullets (field proj 'detail-bullets)))
,(tech-list (field proj 'technologies)))))
card))
;; Title card: blurb only, no projects nested inside.
;; Projects are emitted as siblings after the title card.
@ -64,6 +68,15 @@
(span (@ (class "interest-title")) ,(field item 'title))
(span (@ (class "interest-description")) ,(field item 'description))))
(define (render-interests sec)
`(div (@ (class "interests"))
,@(map render-interest (field sec 'items))))
(define (render-favorite-software sec)
`(div (@ (class "favorite-software"))
,@(map (lambda (s) `(span (@ (class "sw-item")) ,s))
(field sec 'items))))
;; ─── Section → flat list of column children ───────────────────────────────────
(define (section->items sec)
@ -75,37 +88,44 @@
((hobby-projects)
(map render-project (field sec 'projects)))
((interests)
(map render-interest (field sec 'items)))
(list (render-interests sec)))
((favorite-software)
(list (render-favorite-software sec)))
(else '())))
(define (section-label sec)
(case (car sec)
((job) "Work Experience")
((education) "Education")
((hobby-projects) "Projects")
((interests) "Interests")
(else "")))
((job) "Work Experience")
((education) "Education")
((hobby-projects) "Projects")
((interests) "Interests")
((favorite-software) "Favorite Software")
(else "")))
;; Group consecutive sections of same type, emit one heading per group
(define (sections->flat-items sections)
(if (null? sections) '()
(let loop ((rest (cdr sections))
(cur-type (caar sections))
(let loop ((rest (cdr sections))
(cur-type (caar sections))
(cur-label (section-label (car sections)))
(cur-items (section->items (car sections)))
(acc '()))
(acc '()))
(cond
((null? rest)
(append (reverse acc)
;; flush the last group — acc is already in forward order
(append acc
(list `(h2 (@ (class "sec-heading")) ,cur-label))
cur-items))
((eq? (caar rest) cur-type)
;; same type: accumulate items without a new heading
;; same section type: merge items under one heading
(loop (cdr rest) cur-type cur-label
(append cur-items (section->items (car rest)))
acc))
(else
(loop (cdr rest) (caar rest) (section-label (car rest))
;; new section type: flush current group into acc, start new
(loop (cdr rest)
(caar rest)
(section-label (car rest))
(section->items (car rest))
(append acc
(list `(h2 (@ (class "sec-heading")) ,cur-label))
@ -118,7 +138,6 @@
(h1 (@ (class "fm-name")) ,(field fm 'name))
(div (@ (class "fm-contact"))
(span ,(field fm 'location))
(span ,(field fm 'phone))
(span ,(field fm 'email)))))
;; ─── Document ─────────────────────────────────────────────────────────────────
@ -132,7 +151,29 @@
(meta (@ (charset "UTF-8")))
(meta (@ (name "viewport") (content "width=device-width, initial-scale=1")))
(title ,(field fm 'name))
(link (@ (rel "stylesheet") (href "style.css"))))
(link (@ (rel "stylesheet") (href "style.css")))
;; Measure the front-matter height after every resize/zoom and
;; set .columns height to exactly fill the remaining space.
(script "
function setColHeight() {
var fm = document.querySelector('.front-matter');
var col = document.querySelector('.columns');
if (!fm || !col) return;
var used = fm.getBoundingClientRect().height
+ parseInt(getComputedStyle(document.body).paddingTop) * 2;
col.style.height = (window.innerHeight - used) + 'px';
}
window.addEventListener('load', setColHeight);
window.addEventListener('resize', setColHeight);
// zoom via ctrl+/- fires resize in most browsers, but also poll as fallback
var _lastW = window.innerWidth, _lastH = window.innerHeight;
setInterval(function() {
if (window.innerWidth !== _lastW || window.innerHeight !== _lastH) {
_lastW = window.innerWidth; _lastH = window.innerHeight;
setColHeight();
}
}, 200);
"))
(body
,(render-front-matter fm)
(main (@ (class "columns"))