import { Award, Certification, CustomSection, CustomSectionGroup, Education, Experience, Interest, Language, Profile, Project, Publication, Reference, SectionKey, SectionWithItem, Skill, URL, Volunteer, } from "@reactive-resume/schema"; import { cn, isEmptyString, isUrl, linearTransform } from "@reactive-resume/utils"; import get from "lodash.get"; import React, { Fragment } from "react"; import { BrandIcon } from "../components/brand-icon"; import { Picture } from "../components/picture"; import { useArtboardStore } from "../store/artboard"; import { TemplateProps } from "../types/template"; const Header = () => { const basics = useArtboardStore((state) => state.resume.basics); return (
{basics.name}
{basics.headline}
{basics.location && (
{basics.location}
)} {basics.phone && (
{basics.phone}
)} {basics.email && ( )} {basics.customFields.map((item) => (
{isUrl(item.value) ? ( {item.name || item.value} ) : ( {[item.name, item.value].filter(Boolean).join(": ")} )}
))}
); }; const Summary = () => { const section = useArtboardStore((state) => state.resume.sections.summary); if (!section.visible || isEmptyString(section.content)) return null; return (

{section.name}

{section.name}

); }; type RatingProps = { level: number }; const Rating = ({ level }: RatingProps) => (
); type LinkProps = { url: URL; icon?: React.ReactNode; iconOnRight?: boolean; label?: string; className?: string; }; const Link = ({ url, icon, iconOnRight, label, className }: LinkProps) => { if (!isUrl(url.href)) return null; return (
{!iconOnRight && (icon ?? )} {label ?? (url.label || url.href)} {iconOnRight && (icon ?? )}
); }; type LinkedEntityProps = { name: string; url: URL; separateLinks: boolean; className?: string; }; const LinkedEntity = ({ name, url, separateLinks, className }: LinkedEntityProps) => { return !separateLinks && isUrl(url.href) ? ( } iconOnRight={true} className={className} /> ) : (
{name}
); }; type SectionProps = { section: SectionWithItem | CustomSectionGroup; children?: (item: T) => React.ReactNode; className?: string; urlKey?: keyof T; levelKey?: keyof T; summaryKey?: keyof T; keywordsKey?: keyof T; }; const Section = ({ section, children, className, urlKey, levelKey, summaryKey, keywordsKey, }: SectionProps) => { if (!section.visible || section.items.length === 0) return null; return (

{section.name}

{section.name}

{section.items .filter((item) => item.visible) .map((item) => { const url = (urlKey && get(item, urlKey)) as URL | undefined; const level = (levelKey && get(item, levelKey, 0)) as number | undefined; const summary = (summaryKey && get(item, summaryKey, "")) as string | undefined; const keywords = (keywordsKey && get(item, keywordsKey, [])) as string[] | undefined; return (
{children?.(item as T)}
{summary !== undefined && !isEmptyString(summary) && (
)} {level !== undefined && level > 0 && } {keywords !== undefined && keywords.length > 0 && (

{keywords.join(", ")}

)} {url !== undefined && section.separateLinks && }
); })}
); }; const Profiles = () => { const section = useArtboardStore((state) => state.resume.sections.profiles); return ( section={section}> {(item) => (
{isUrl(item.url.href) ? ( } /> ) : (

{item.username}

)} {!item.icon &&

{item.network}

}
)} ); }; const Experience = () => { const section = useArtboardStore((state) => state.resume.sections.experience); return ( section={section} urlKey="url" summaryKey="summary"> {(item) => (
{item.position}
{item.location}
{item.date}
)} ); }; const Education = () => { const section = useArtboardStore((state) => state.resume.sections.education); return ( section={section} urlKey="url" summaryKey="summary"> {(item) => (
{item.area}
{item.score}
{item.studyType}
{item.date}
)} ); }; const Awards = () => { const section = useArtboardStore((state) => state.resume.sections.awards); return ( section={section} urlKey="url" summaryKey="summary"> {(item) => (
{item.title}
{item.date}
)} ); }; const Certifications = () => { const section = useArtboardStore((state) => state.resume.sections.certifications); return ( section={section} urlKey="url" summaryKey="summary"> {(item) => (
{item.name}
{item.date}
)} ); }; const Skills = () => { const section = useArtboardStore((state) => state.resume.sections.skills); return ( section={section} levelKey="level" keywordsKey="keywords"> {(item) => (
{item.name}
{item.description}
)} ); }; const Interests = () => { const section = useArtboardStore((state) => state.resume.sections.interests); return ( section={section} keywordsKey="keywords" className="space-y-0.5"> {(item) =>
{item.name}
} ); }; const Publications = () => { const section = useArtboardStore((state) => state.resume.sections.publications); return ( section={section} urlKey="url" summaryKey="summary"> {(item) => (
{item.publisher}
{item.date}
)} ); }; const Volunteer = () => { const section = useArtboardStore((state) => state.resume.sections.volunteer); return ( section={section} urlKey="url" summaryKey="summary"> {(item) => (
{item.position}
{item.location}
{item.date}
)} ); }; const Languages = () => { const section = useArtboardStore((state) => state.resume.sections.languages); return ( section={section} levelKey="level"> {(item) => (
{item.name}
{item.description}
)} ); }; const Projects = () => { const section = useArtboardStore((state) => state.resume.sections.projects); return ( section={section} urlKey="url" summaryKey="summary" keywordsKey="keywords"> {(item) => (
{item.description}
{item.date}
)} ); }; const References = () => { const section = useArtboardStore((state) => state.resume.sections.references); return ( section={section} urlKey="url" summaryKey="summary"> {(item) => (
{item.description}
)} ); }; const Custom = ({ id }: { id: string }) => { const section = useArtboardStore((state) => state.resume.sections.custom[id]); return ( section={section} urlKey="url" summaryKey="summary" keywordsKey="keywords" > {(item) => (
{item.description}
{item.date}
{item.location}
)} ); }; const mapSectionToComponent = (section: SectionKey) => { switch (section) { case "profiles": { return ; } case "summary": { return ; } case "experience": { return ; } case "education": { return ; } case "awards": { return ; } case "certifications": { return ; } case "skills": { return ; } case "interests": { return ; } case "publications": { return ; } case "volunteer": { return ; } case "languages": { return ; } case "projects": { return ; } case "references": { return ; } default: { if (section.startsWith("custom.")) return ; return null; } } }; export const Azurill = ({ columns, isFirstPage = false }: TemplateProps) => { const [main, sidebar] = columns; return (
{isFirstPage &&
}
{sidebar.map((section) => ( {mapSectionToComponent(section)} ))}
0 ? "col-span-2" : "col-span-3")} > {main.map((section) => ( {mapSectionToComponent(section)} ))}
); };