feat(cv): expand builder studio tools

This commit is contained in:
cesnimda
2026-08-29 01:45:30 +02:00
parent f794265e3e
commit 0f17d95c57
10 changed files with 434 additions and 47 deletions
+4
View File
@@ -31,6 +31,8 @@ public sealed class CvRenderSection
public List<string> Tags { get; set; } = new();
public List<CvRenderEntry> Entries { get; set; } = new();
public List<CvRenderSkillGroup> SkillGroups { get; set; } = new();
public string? Presentation { get; set; }
public int Columns { get; set; } = 1;
public bool IsEmpty => Bullets.Count == 0 && Tags.Count == 0 && Entries.Count == 0 && SkillGroups.Count == 0;
}
@@ -158,6 +160,8 @@ public static class CvVariantResolver
{
section.Entries = ReorderByKey(section.Entries, cfg.ItemOrder);
}
section.Presentation = cfg.Presentation;
section.Columns = cfg.Columns is 2 ? 2 : 1;
}
else if (customHiddenByKey.TryGetValue(key, out var customHidden) && customHidden)
{
+12 -1
View File
@@ -141,7 +141,9 @@ public sealed class ThemedCvRenderer : IThemedCvRenderer
_ => string.Join("", section.Entries.Select(RenderEntry)),
};
var flowClass = IsFlowingSection(section) ? " section-flow" : string.Empty;
return $@"<section class=""section section-{Attr(section.Key)}{flowClass}""><h2 class=""section-title""><span class=""section-title-text"">{Enc(section.Title)}</span></h2>{inner}</section>";
var presentation = section.Presentation is "grid" or "compact" or "bubble" ? section.Presentation : "rows";
var columns = presentation == "grid" && section.Columns == 2 ? 2 : 1;
return $@"<section class=""section section-{Attr(section.Key)}{flowClass} section-presentation-{presentation}"" style=""--cv-section-columns:{columns}""><h2 class=""section-title""><span class=""section-title-text"">{Enc(section.Title)}</span></h2>{inner}</section>";
}
private static string RenderSkillGroup(CvRenderSkillGroup group)
@@ -219,6 +221,7 @@ public sealed class ThemedCvRenderer : IThemedCvRenderer
var margin = F((settings.PageMarginMm ?? t.PageMarginMm) * density);
var sectionGap = F((settings.SectionGapMm ?? t.SectionGapMm) * density);
var entryGap = F((settings.EntryGapMm ?? t.EntryGapMm) * density);
var compactEntryGap = F(Math.Max(1.5, (settings.EntryGapMm ?? t.EntryGapMm) * density * .55));
var bodySize = settings.BaseFontSizePt ?? t.BodySizePt;
var headingSize = settings.HeadingSizePt ?? t.HeadingSizePt;
var lineHeight = settings.LineHeight ?? t.LineHeight;
@@ -283,6 +286,14 @@ h1,h2{{font-family:{headingFont};}}
.section:first-child{{margin-top:0;}}
.section-title{{margin:0 0 {F(2.6 * density)}mm 0;font-size:{F(headingSize)}pt;font-weight:700;color:{headingColor};}}
{headingCss}
.section-presentation-grid{{display:grid;grid-template-columns:repeat(var(--cv-section-columns,1),minmax(0,1fr));column-gap:4mm;align-items:start;}}
.section-presentation-grid>.section-title{{grid-column:1/-1;}}
.section-presentation-grid>.entry{{min-width:0;}}
.section-presentation-compact>.entry{{margin-bottom:{compactEntryGap}mm;}}
.section-presentation-compact>.bullets li{{margin-bottom:{F(.75 * density)}mm;}}
.section-presentation-bubble>.tags,.section-presentation-bubble>.bullets{{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:1.4mm;}}
.section-presentation-bubble>.bullets li,.section-presentation-bubble>.tags li{{margin:0;border:1px solid var(--cv-accent-soft);border-radius:999px;padding:.7mm 2.2mm;}}
.section-presentation-bubble>.bullets li::marker{{content:"";}}
.bullets{{margin:0;padding-left:4.5mm;}}
.bullets li{{margin:0 0 {F(1.6 * density)}mm 0;}}
.bullets li::marker{{color:var(--cv-accent-color);}}