resume/lib/lib.typ
2025-01-13 02:43:26 -05:00

163 lines
3.8 KiB
Plaintext

#import "fontawesome.typ": github, fa, link-icon
#let DEFAULT_STRONG = 300;
#let SMALL_STRONG = 200;
#let TITLE_FONT = "Bitter"
#let HEADING_FONT = TITLE_FONT
#let BODY_FONT = "Open Sans"
#let BODY_FONT_SIZE = 9.75pt
#let HEADING_FONT_SIZE = 0.95em
#let TITLE_FONT_SIZE = 2em
#let HEADING_LINE_GAP = 3mm
#let BODY_LINE_HEIGHT = 0.75em
#let HEADING_DETAILS_LIST_SPACING = 0.9em
#let DETAILS_TITLE_FONT_SIZE = 1.075em
#let DETAILS_LIST_SPACING = 0.8em
#let DETAILS_LIST_INDENT = 1.5em
// rest = not top
#let PAGE_MARGINS = (right: 0.5in, top: 0.3in, left: 0.4in, bottom: 0.4in)
// Format locations.
#let format_location(location) = {
[_#block(above: 0.7em, location)_]
}
#let indent(content) = {
block(inset: (left: 0.75em, right: 0.5em), content)
}
// General entry that is split into a left and right half (for experience and education).
#let cv_entry(left_content: none, right_content: none, details: none) = {
stack(
dir: ttb,
spacing: HEADING_DETAILS_LIST_SPACING,
grid(columns: (15fr, 5fr), column-gutter: 0cm, {
set strong(delta: DEFAULT_STRONG)
set align(left)
left_content
}, {
set strong(delta: SMALL_STRONG)
set align(right)
right_content
}),
{
set strong(delta: SMALL_STRONG)
show link: underline
list(tight: false, spacing: DETAILS_LIST_SPACING, marker: [•], ..details)
},
)
}
// Entry for work.
#let work_entry(
role,
company,
tools: none,
tasks: none,
start_date: none,
end_date: none,
location: none,
company_link: none,
) = {
cv_entry(left_content: {
set par(leading: 0.75em)
text(1.1em)[*#role*]
if tools != none {
text[ | _ #tools _ ]
}
"\n"
set strong(delta: SMALL_STRONG)
if company_link == none {
[*#company*]
} else {
[#link(company_link)[*#company*]]
}
}, right_content: {
[*#start_date -- #end_date*]
if location != none {
"\n" + format_location(location)
}
}, details: tasks)
}
#let project(title, tools, repo_link: none, demo_link: none, tasks: none) = {
set strong(delta: DEFAULT_STRONG)
let text_link = if demo_link != none { demo_link } else { repo_link }
let content_title = {
if text_link != none {
link(text_link)[#text(1.1em)[*#title*]]
} else {
text(1.1em)[*#title*]
}
if demo_link != none {
link(demo_link)[#text(1.1em)[ #fa(link-icon) ]]
}
if repo_link != none {
link(repo_link)[#text(1.1em)[ #fa(github) ]]
}
[ | _ #tools _ ]
}
cv_entry(left_content: content_title, details: tasks)
}
// Set name and contact data and format headings
#let template(name, color, doc) = {
set page(margin: PAGE_MARGINS, paper: "us-letter")
set list(indent: DETAILS_LIST_INDENT, marker: [•])
set text(font: (BODY_FONT), BODY_FONT_SIZE)
set par(justify: true, leading: BODY_LINE_HEIGHT)
align(center)[
#text(size: TITLE_FONT_SIZE, font: TITLE_FONT, fill: color)[*#name*]
#block(above: 0em, below: 1em)
]
show heading.where(level: 1): i => {
set align(left + horizon)
let title = smallcaps(i.body)
let colored_line(header_text) = {
let size = measure(header_text)
// 100% - spacing - width of text
line(
length: 100% - HEADING_LINE_GAP - size.width,
stroke: (paint: color, thickness: 2pt, cap: "round"),
)
}
set block(above: 0.9em, below: 0.75em)
set text(size: HEADING_FONT_SIZE, fill: color, font: HEADING_FONT)
stack(
dir: ltr,
spacing: HEADING_LINE_GAP,
title,
box(height: 2pt, fill: color, colored_line(title)),
)
}
doc
}
#let render_contact_data(data) = {
align(center)[
#let elements = for el in data {
(link(el.link)[#{ el.service + " " + el.display }],)
}
#text(1em)[#elements.join(" | ")]
]
}