fix: date vertical offset scales with headline font size

Compute vertical offset relative to the weekday headline font size
instead of the date's own small font. Top shifts up 55%, center 25%,
bottom stays at baseline — giving visible, proportional alignment.

v1.34.4

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
mARTin 2026-03-15 09:13:35 +01:00
parent d6009ef7b2
commit 6409dd8908
2 changed files with 37 additions and 32 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "my-weekly-todo-list", "name": "my-weekly-todo-list",
"version": "1.34.3", "version": "1.34.4",
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -6420,13 +6420,22 @@ export default function WeeklyView() {
gap: profile.dateAlignment === "tight" ? "2px" : (profile.dayHeaderGap || "0.35em"), gap: profile.dateAlignment === "tight" ? "2px" : (profile.dayHeaderGap || "0.35em"),
}} }}
> >
{(() => {
// Compute date vertical offset relative to weekday font size
const isHorizontal = activeDateLayout === "left" || activeDateLayout === "right" || activeDateLayout === undefined;
const headlineSizePx = parseFloat(profile.headlineFontSize || "1.25rem") * (String(profile.headlineFontSize || "").includes("px") ? 1 : 16);
const dateOffset = !isHorizontal ? undefined
: profile.dateVerticalAlign === "top" ? `${-headlineSizePx * 0.55}px`
: profile.dateVerticalAlign === "bottom" ? "0px"
: `${-headlineSizePx * 0.25}px`; // center
const dateStyle = isHorizontal ? {
flexShrink: 0 as const, marginBottom: 0,
position: "relative" as const, top: dateOffset,
} : { flexShrink: 0 as const };
return (
<>
{activeDateLayout === "left" && ( {activeDateLayout === "left" && (
<span className="weekly-day-date" style={{ <span className="weekly-day-date" style={dateStyle}>
flexShrink: 0,
marginBottom: 0,
position: "relative",
top: profile.dateVerticalAlign === "top" ? "-0.35em" : profile.dateVerticalAlign === "bottom" ? "0.1em" : "-0.1em",
}}>
{formatDateHeader(date, language)} {formatDateHeader(date, language)}
</span> </span>
)} )}
@ -6440,17 +6449,13 @@ export default function WeeklyView() {
activeDateLayout === "above" || activeDateLayout === "above" ||
activeDateLayout === "below" || activeDateLayout === "below" ||
activeDateLayout === undefined) && ( activeDateLayout === undefined) && (
<span className="weekly-day-date" style={{ <span className="weekly-day-date" style={dateStyle}>
flexShrink: 0,
marginBottom: (activeDateLayout === "above" || activeDateLayout === "below") ? undefined : 0,
...(activeDateLayout !== "above" && activeDateLayout !== "below" ? {
position: "relative" as const,
top: profile.dateVerticalAlign === "top" ? "-0.35em" : profile.dateVerticalAlign === "bottom" ? "0.1em" : "-0.1em",
} : {}),
}}>
{formatDateHeader(date, language)} {formatDateHeader(date, language)}
</span> </span>
)} )}
</>
);
})()}
</div> </div>
</header> </header>