diff --git a/components/Certificates/index.js b/components/Certificates/index.js index 9bfbb58..c3d553d 100644 --- a/components/Certificates/index.js +++ b/components/Certificates/index.js @@ -2,16 +2,19 @@ import { ShortDate } from '../utils/date.js' import html from '../utils/html.js' import Link from '../utils/link.js' +/** @typedef {NonNullable} 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`
-

Certificates

+

${title}

${certificates.map( ({ date, issuer, name, url, itemtype = 'Organization' }) => html` diff --git a/components/Education/index.js b/components/Education/index.js index 9286c23..0b8e618 100644 --- a/components/Education/index.js +++ b/components/Education/index.js @@ -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`
-

Education

+

${title}

${education.map(role => Institution(role, 'alumniOf'))}
` diff --git a/components/Interests/index.js b/components/Interests/index.js index 8102fbb..53decb2 100644 --- a/components/Interests/index.js +++ b/components/Interests/index.js @@ -1,15 +1,18 @@ import html from '../utils/html.js' +/** @typedef {NonNullable} 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`
-

Interests

+

${title}

${interests.map( ({ keywords = [], name, itemtype = 'Thing' }) => html` diff --git a/components/Languages/index.js b/components/Languages/index.js index 4633517..5b3f40c 100644 --- a/components/Languages/index.js +++ b/components/Languages/index.js @@ -1,15 +1,18 @@ import html from '../utils/html.js' +/** @typedef {NonNullable} 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`
-

Languages

+

${title}

${languages.map( ({ fluency, language }) => html` diff --git a/components/Meta/index.js b/components/Meta/index.js index 7f043ac..d399613 100644 --- a/components/Meta/index.js +++ b/components/Meta/index.js @@ -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 = {}) { diff --git a/components/Projects/index.js b/components/Projects/index.js index 4a9f47d..27725f6 100644 --- a/components/Projects/index.js +++ b/components/Projects/index.js @@ -1,16 +1,19 @@ import html from '../utils/html.js' import Project from './project.js' +/** @typedef {NonNullable} 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`
-

Projects

+

${title}

${projects.map(role => Project(role, 'alumniOf'))}
` diff --git a/components/Publications/index.js b/components/Publications/index.js index cc50001..148957b 100644 --- a/components/Publications/index.js +++ b/components/Publications/index.js @@ -3,16 +3,19 @@ import html from '../utils/html.js' import Link from '../utils/link.js' import markdown from '../utils/markdown.js' +/** @typedef {NonNullable} 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`
-

Publications

+

${title}

${publications.map( ({ diff --git a/components/References/index.js b/components/References/index.js index c9551ee..5bb527f 100644 --- a/components/References/index.js +++ b/components/References/index.js @@ -1,16 +1,19 @@ import html from '../utils/html.js' import markdown from '../utils/markdown.js' +/** @typedef {NonNullable} 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`
-

References

+

${title}

${references.map( ({ name, reference }) => html` diff --git a/components/ResumeArticle/index.js b/components/ResumeArticle/index.js index c8642a5..c6b12ac 100644 --- a/components/ResumeArticle/index.js +++ b/components/ResumeArticle/index.js @@ -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 diff --git a/components/Skills/index.js b/components/Skills/index.js index e861420..38c210e 100644 --- a/components/Skills/index.js +++ b/components/Skills/index.js @@ -1,15 +1,18 @@ import html from '../utils/html.js' +/** @typedef {NonNullable} 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`
-

Skills

+

${title}

${skills.map(({ keywords = [], name, itemtype = 'Thing' }) => { const itype = `itemtype="https://schema.org/${itemtype}"` diff --git a/components/Volunteer/index.js b/components/Volunteer/index.js index 6fec3e2..72966d3 100644 --- a/components/Volunteer/index.js +++ b/components/Volunteer/index.js @@ -1,16 +1,19 @@ import html from '../utils/html.js' import VolunteerRole from './volunteer-role.js' +/** @typedef {NonNullable} 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`
-

Volunteer

+

${title}

${volunteer.map(role => VolunteerRole(role, 'alumniOf'))}
` diff --git a/components/Work/index.js b/components/Work/index.js index 4e94eff..32afac8 100644 --- a/components/Work/index.js +++ b/components/Work/index.js @@ -4,15 +4,16 @@ import WorkRole from './work-role.js' /** @typedef {NonNullable} 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`
-

Work

+

${title}

${work.map(role => WorkRole(role, 'alumniOf'))}
` diff --git a/components/utils/colors.js b/components/utils/colors.js index 2cb19fa..4664c1b 100644 --- a/components/utils/colors.js +++ b/components/utils/colors.js @@ -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 = {}) { diff --git a/components/utils/html-meta.js b/components/utils/html-meta.js index a065030..dfed82c 100644 --- a/components/utils/html-meta.js +++ b/components/utils/html-meta.js @@ -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 = {}) { diff --git a/schema.json b/schema.json index 275ac4d..9e88368 100644 --- a/schema.json +++ b/schema.json @@ -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" + } } } } diff --git a/test/__snapshots__/index.test.js.snap b/test/__snapshots__/index.test.js.snap index 4d9a923..8ff6e46 100644 --- a/test/__snapshots__/index.test.js.snap +++ b/test/__snapshots__/index.test.js.snap @@ -63,17 +63,17 @@ exports[`renders a resume 1`] = `
-
-
-
-
Twitter
-
-
-
SoundCloud
-
-
-
-
+
+
+
+
Twitter
+
+
+
SoundCloud
+
+
+
+
diff --git a/tsconfig.json b/tsconfig.json index 36cfe86..e15a1e1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,8 @@ "moduleResolution": "nodenext", "noEmit": true, "strict": true, + "skipLibCheck": true, "target": "esnext" - } + }, + "exclude": ["node_modules"] }