feat(resume): Add wrapit library to dynamically add sidebar

Removes issue that grid will be static throughout all pages and thus
empty space where the sidebar is on page 1. Now, the sidebar aligns
nicely along the first page but then we can use the full width for the
next few pages.
This commit is contained in:
Marty Oehme 2025-03-18 14:57:57 +01:00
parent bb9606b2db
commit 1afc51a857
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 374 additions and 43 deletions

View file

@ -1,4 +1,5 @@
#import "lib.typ": *
#import "wrapit.typ": *
#let create_body(main: (), contents: (:)) = {
for item in main {
@ -86,7 +87,7 @@
}
}
#let resume(contents, main: ( "experience", "education"), sidebar: ("volunteering", "languages", "skills")) = {
#let resume(contents, main: ("experience", "education"), sidebar: ("volunteering", "languages", "skills")) = {
show: style
set text(lang: lang)
@ -119,53 +120,43 @@
header(contents.about)
set block(above: 10pt)
show heading.where(level: 1): it => style(s => {
let h = text(size: 18pt, upper(it))
let dim = measure(h, s)
stack(
dir: ltr,
h,
place(
dy: 7pt,
dx: 10pt,
horizon + left,
line(stroke: accent-color, length: 100% - dim.width - 10pt),
),
)
})
let margin = 1pt
grid(
columns: (2fr, 1fr),
let sb = if sidebar.len() > 0 {
block(
outset: 0pt,
inset: (top: 0.4 * margin, right: 0pt, rest: margin),
stroke: none,
width: 100%,
fill: luma(230),
inset: (top: 15 * margin, left: 10 * margin, right: 15 * margin, bottom: 15 * margin),
{
set block(above: 10pt)
show heading.where(level: 1): it => style(s => {
let h = text(size: 18pt, upper(it))
let dim = measure(h, s)
stack(
dir: ltr,
h,
place(
dy: 7pt,
dx: 10pt,
horizon + left,
line(stroke: accent-color, length: 100% - dim.width - 10pt),
),
)
})
create_body(main: main, contents: contents)
show heading: it => align(right, upper(it))
set list(marker: "")
show list: it => {
set par(justify: false)
align(right, block(it))
}
create_sidebar(sidebar: sidebar, contents: contents)
},
),
align(
right,
block(
fill: luma(230),
width: 90%,
{
v(15pt)
set block(inset: (left: 5 * margin, right: 5 * margin))
show heading: it => align(right, upper(it))
set list(marker: "")
show list: it => {
set par(justify: false)
align(right, block(it))
}
create_sidebar(sidebar: sidebar, contents: contents)
v(15pt)
},
),
),
)
} else { [] }
wrap-content(
sb,
create_body(main: main, contents: contents),
align: top + right,
columns: (auto, 30%),
)
}