Skip to content

Commit

Permalink
📝 add params for section titles
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnath committed May 9, 2024
1 parent 0e88d06 commit 7adf75b
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 45 deletions.
9 changes: 6 additions & 3 deletions components/Certificates/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ import { ShortDate } from '../utils/date.js'
import html from '../utils/html.js'
import Link from '../utils/link.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['certificates']>} Certificates */

/**
* @param {import('../../schema.d.ts').ResumeSchema['certificates']} certificates
* @param {Certificates} certificates
* @param {string} [title] - section title text
* @returns {string | false}
*/
export default function Certificates(certificates = []) {
export default function Certificates(certificates = [], title = 'Certificates') {
return (
certificates.length > 0 &&
html`
<section part="certificates">
<h3>Certificates</h3>
<h3>${title}</h3>
<dl class="stack">
${certificates.map(
({ date, issuer, name, url, itemtype = 'Organization' }) => html`
Expand Down
5 changes: 3 additions & 2 deletions components/Education/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import Institution from './institution.js'

/**
* @param {Education} education
* @param {string} [title] - section title text
* @returns {string | false}
*/
export default function Education(education = []) {
export default function Education(education = [], title = 'Education') {
return education.length > 0
? html`
<section part="education">
<h3>Education</h3>
<h3>${title}</h3>
<div class="stack">${education.map(role => Institution(role, 'alumniOf'))}</div>
</section>
`
Expand Down
9 changes: 6 additions & 3 deletions components/Interests/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import html from '../utils/html.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['interests']>} Interests */

/**
* @param {import('../../schema.d.ts').ResumeSchema['interests']} interests
* @param {Interests} interests
* @param {string} [title] - section title text
* @returns {string | false}
*/
export default function Interests(interests = []) {
export default function Interests(interests = [], title = 'Interests') {
return (
interests.length > 0 &&
html`
<section part="interests">
<h3>Interests</h3>
<h3>${title}</h3>
<dl class="grid-list">
${interests.map(
({ keywords = [], name, itemtype = 'Thing' }) => html`
Expand Down
9 changes: 6 additions & 3 deletions components/Languages/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import html from '../utils/html.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['languages']>} Languages */

/**
* @param {import('../../schema.d.ts').ResumeSchema['languages']} languages
* @param {Languages} languages
* @param {string} [title] - section title text
* @returns {string | false}
*/
export default function Languages(languages = []) {
export default function Languages(languages = [], title = 'Languages') {
return (
languages.length > 0 &&
html`
<section part="languages">
<h3>Languages</h3>
<h3>${title}</h3>
<dl class="grid-list">
${languages.map(
({ fluency, language }) => html`
Expand Down
4 changes: 3 additions & 1 deletion components/Meta/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { DateTime } from '../utils/date.js'
import html from '../utils/html.js'
import Link from '../utils/link.js'

/** @typedef {import('../../schema.d.ts').ResumeSchema['meta']} Meta */

/**
* @param {import('../../schema.d.ts').ResumeSchema['meta']} meta
* @param {Meta} meta
* @returns {string | false}
*/
export default function Meta(meta = {}) {
Expand Down
9 changes: 6 additions & 3 deletions components/Projects/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import html from '../utils/html.js'
import Project from './project.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['projects']>} Projects */

/**
* @param {import('../../schema.d.ts').ResumeSchema['projects']} projects
* @param {Projects} projects
* @param {string} [title] - section title text
* @returns {string | false}
*/
export default function Projects(projects = []) {
export default function Projects(projects = [], title = 'Projects') {
return (
projects.length > 0 &&
html`
<section part="projects">
<h3>Projects</h3>
<h3>${title}</h3>
<div class="stack">${projects.map(role => Project(role, 'alumniOf'))}</div>
</section>
`
Expand Down
9 changes: 6 additions & 3 deletions components/Publications/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ import html from '../utils/html.js'
import Link from '../utils/link.js'
import markdown from '../utils/markdown.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['publications']>} Publications */

/**
* @param {import('../../schema.js').ResumeSchema['publications']} publications
* @param {Publications} publications
* @param {string} [title] - section title text
* @returns {string | false}
*/
export default function Publications(publications = []) {
export default function Publications(publications = [], title = 'Publications') {
return (
publications.length > 0 &&
html`
<section part="publications">
<h3>Publications</h3>
<h3>${title}</h3>
<dl class="stack">
${publications.map(
({
Expand Down
9 changes: 6 additions & 3 deletions components/References/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import html from '../utils/html.js'
import markdown from '../utils/markdown.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['references']>} References */

/**
* @param {import('../../schema.d.ts').ResumeSchema['references']} references
* @param {References} references
* @param {string} [title] - section title text
* @returns {string | false}
*/
export default function References(references = []) {
export default function References(references = [], title = 'References') {
return (
references.length > 0 &&
html`
<section part="references">
<h3>References</h3>
<h3>${title}</h3>
<div class="stack">
${references.map(
({ name, reference }) => html`
Expand Down
1 change: 0 additions & 1 deletion components/ResumeArticle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from '../index.js'
import html from '../utils/html.js'

console.log(Basics)
/**
* Generate resume internal content
* @todo order-of-items _from_ resume.json
Expand Down
9 changes: 6 additions & 3 deletions components/Skills/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import html from '../utils/html.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['skills']>} Skills */

/**
* @param {import('../../schema.d.ts').ResumeSchema['skills']} skills
* @param {Skills} skills
* @param {string} [title] - section title text
* @returns {string | false}
*/
export default function Skills(skills = []) {
export default function Skills(skills = [], title = 'Skills') {
return (
skills.length > 0 &&
html`
<section part="skills">
<h3>Skills</h3>
<h3>${title}</h3>
<dl class="grid-list">
${skills.map(({ keywords = [], name, itemtype = 'Thing' }) => {
const itype = `itemtype="https://schema.org/${itemtype}"`
Expand Down
9 changes: 6 additions & 3 deletions components/Volunteer/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import html from '../utils/html.js'
import VolunteerRole from './volunteer-role.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['volunteer']>} Volunteer */

/**
* @param {import('../../schema.d.ts').ResumeSchema['volunteer']} volunteer
* @param {Volunteer} volunteer
* @param {string} [title] - section title text
* @returns {string | false}
*/
export default function Volunteer(volunteer = []) {
export default function Volunteer(volunteer = [], title = 'Volunteer') {
return (
volunteer.length > 0 &&
html`
<section part="volunteer">
<h3>Volunteer</h3>
<h3>${title}</h3>
<div class="stack">${volunteer.map(role => VolunteerRole(role, 'alumniOf'))}</div>
</section>
`
Expand Down
7 changes: 4 additions & 3 deletions components/Work/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import WorkRole from './work-role.js'
/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['work']>} Work */

/**
* @param {import('../../schema.d.ts').ResumeSchema['work']} work
* @param {Work} work
* @param {string} [title] - section title text
* @returns {string | false}
*/
export default function Work(work = []) {
export default function Work(work = [], title = 'Work') {
return (
work.length > 0 &&
html`
<section part="work">
<h3>Work</h3>
<h3>${title}</h3>
<div class="stack">${work.map(role => WorkRole(role, 'alumniOf'))}</div>
</section>
`
Expand Down
2 changes: 1 addition & 1 deletion components/utils/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/** @typedef {{ colors?: ThemeColorOptions }} ThemeOptions */

/**
* @param {import('../../schema').ResumeSchema['meta'] & { themeOptions?: ThemeOptions }} meta
* @param {import('../../schema.d.ts').ResumeSchema['meta'] & { themeOptions?: ThemeOptions }} meta
* @returns {string | undefined}
*/
export default function colors(meta = {}) {
Expand Down
2 changes: 1 addition & 1 deletion components/utils/html-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import html from './html.js'
import markdown from './markdown.js'

/**
* @param {import('../../schema').ResumeSchema['basics']} basics
* @param {import('../../schema.d.ts').ResumeSchema['basics']} basics
* @returns {string}
*/
export default function HeadMeta(basics = {}) {
Expand Down
19 changes: 19 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,25 @@
"lastModified": {
"type": "string",
"description": "Using ISO 8601 with YYYY-MM-DDThh:mm:ss"
},
"sectionTitles": {
"type": "object",
"description": "The title text used in each section's heading",
"default": {
"basics": "Basics",
"work": "Work",
"volunteer": "Volunteer",
"education": "Education",
"awards": "Awards",
"certificates": "Certificates",
"publications": "Publications",
"skills": "Skills",
"languages": "Languages",
"interests": "Interests",
"references": "References",
"projects": "Projects",
"meta": "meta"
}
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions test/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ exports[`renders a resume 1`] = `
</dl>
</address>
<address part="profiles">
<dl class="icon-list">
<div itemprop="ContactPoint" itemscope itemtype="https://schema.org/ContactPoint">
<dt style="--svg-network:url('data:image/svg+xml, %3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20class%3D%22feather%20feather-twitter%22%3E%3Cpath%20d%3D%22M23%203a10.9%2010.9%200%200%201-3.14%201.53%204.48%204.48%200%200%200-7.86%203v1A10.66%2010.66%200%200%201%203%204s-4%209%205%2013a11.64%2011.64%200%200%201-7%202c9%205%2020%200%2020-11.5a4.5%204.5%200%200%200-.08-.83A7.72%207.72%200%200%200%2023%203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E')" itemprop="contactType"><span class="sr-only">Twitter</span></dt>
<dd data-network="Twitter"><a href="" itemprop="url"><span itemprop="identifier">neutralthoughts</span></a></dd>
</div> <div itemprop="ContactPoint" itemscope itemtype="https://schema.org/ContactPoint">
<dt itemprop="contactType"><span class="sr-only">SoundCloud</span></dt>
<dd data-network="SoundCloud"><a href="https://soundcloud.example.com/dandymusicnl" itemprop="url"><span itemprop="identifier">dandymusicnl</span></a></dd>
</div>
</dl>
</address>
<address part="profiles">
<dl class="icon-list">
<div itemprop="ContactPoint" itemscope itemtype="https://schema.org/ContactPoint">
<dt style="--svg-network:url('data:image/svg+xml, %3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20class%3D%22feather%20feather-twitter%22%3E%3Cpath%20d%3D%22M23%203a10.9%2010.9%200%200%201-3.14%201.53%204.48%204.48%200%200%200-7.86%203v1A10.66%2010.66%200%200%201%203%204s-4%209%205%2013a11.64%2011.64%200%200%201-7%202c9%205%2020%200%2020-11.5a4.5%204.5%200%200%200-.08-.83A7.72%207.72%200%200%200%2023%203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E')" itemprop="contactType"><span class="sr-only">Twitter</span></dt>
<dd data-network="Twitter"><a href="" itemprop="url"><span itemprop="identifier">neutralthoughts</span></a></dd>
</div> <div itemprop="ContactPoint" itemscope itemtype="https://schema.org/ContactPoint">
<dt itemprop="contactType"><span class="sr-only">SoundCloud</span></dt>
<dd data-network="SoundCloud"><a href="https://soundcloud.example.com/dandymusicnl" itemprop="url"><span itemprop="identifier">dandymusicnl</span></a></dd>
</div>
</dl>
</address>
</header>
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"moduleResolution": "nodenext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"target": "esnext"
}
},
"exclude": ["node_modules"]
}

0 comments on commit 7adf75b

Please sign in to comment.