Files
Reactive-Resume/packages/schema/src/resume/level-display-sizes.ts
T
Amruth Pillai 1414fecade fix(pdf): apply custom style fontSize to icons and level indicators (#3120) and
* fix(pdf): apply custom style fontSize to icon and level indicator sizes

Map fontSize from Icon and Level Indicator custom style slots to Phosphor
icon size and level indicator dimensions, since react-pdf icons ignore
fontSize in favor of the size prop.

* fix: separate global icon and scoped level indicator font sizes

Icon slot fontSize now drives all resume icons plus level display
decorations. Level indicator fontSize overrides only within level display.
Shared sizing logic lives in schema; design sidebar preview uses global rules.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-05-29 00:41:21 +02:00

28 lines
848 B
TypeScript

export type ResolveLevelDisplaySizesOptions = {
bodyFontSize: number;
iconFontSize?: number | undefined;
levelFontSize?: number | undefined;
};
export type LevelDisplaySizes = {
decorationSize: number;
levelIconExplicitSize?: number | undefined;
};
export const resolveLevelDisplaySizes = (options: ResolveLevelDisplaySizesOptions): LevelDisplaySizes => {
const defaultDecorationSize = options.bodyFontSize - 2;
const legacyLevelIconSize = defaultDecorationSize + 4;
const decorationSize = options.levelFontSize ?? options.iconFontSize ?? defaultDecorationSize;
if (options.levelFontSize !== undefined) {
return { decorationSize, levelIconExplicitSize: options.levelFontSize };
}
if (options.iconFontSize !== undefined) {
return { decorationSize };
}
return { decorationSize, levelIconExplicitSize: legacyLevelIconSize };
};