fix(cv): restore distinct responsive templates
This commit is contained in:
@@ -176,6 +176,27 @@ export function getCvPageCount(contentHeightPx: number, pageHeightPx: number): n
|
||||
return Math.max(1, Math.ceil(Math.max(0, contentHeightPx - 2) / pageHeightPx));
|
||||
}
|
||||
|
||||
export function getCvPreviewFitZoom(containerWidthPx: number, pageWidthPx: number, gutterPx = 24, minZoom = 0.32): number {
|
||||
if (!Number.isFinite(containerWidthPx) || !Number.isFinite(pageWidthPx) || pageWidthPx <= 0) return minZoom;
|
||||
const usableWidth = Math.max(1, containerWidthPx - gutterPx);
|
||||
return Math.min(1, Math.max(minZoom, usableWidth / pageWidthPx));
|
||||
}
|
||||
|
||||
// Selecting a template is a structural choice. Clear only the presentation overrides that can
|
||||
// flatten every template into the previous template's layout; keep content, colour, typography,
|
||||
// spacing and document settings intact.
|
||||
export function applyCvTheme(settings: CvVariantSettings, themeId: string): CvVariantSettings {
|
||||
return {
|
||||
...settings,
|
||||
themeId,
|
||||
layout: null,
|
||||
headerStyle: null,
|
||||
headingStyle: null,
|
||||
sidebarWidthMm: null,
|
||||
sidebarSections: null,
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeCvLanguage(language?: string | null): string {
|
||||
const normalized = language?.trim().toLowerCase();
|
||||
return normalized === "no" || normalized === "nb" || normalized === "nb-no" ? "nb-NO" : normalized || "en";
|
||||
|
||||
Reference in New Issue
Block a user