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:
parent
d6009ef7b2
commit
6409dd8908
@ -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": {
|
||||||
|
|||||||
@ -6420,37 +6420,42 @@ export default function WeeklyView() {
|
|||||||
gap: profile.dateAlignment === "tight" ? "2px" : (profile.dayHeaderGap || "0.35em"),
|
gap: profile.dateAlignment === "tight" ? "2px" : (profile.dayHeaderGap || "0.35em"),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{activeDateLayout === "left" && (
|
{(() => {
|
||||||
<span className="weekly-day-date" style={{
|
// Compute date vertical offset relative to weekday font size
|
||||||
flexShrink: 0,
|
const isHorizontal = activeDateLayout === "left" || activeDateLayout === "right" || activeDateLayout === undefined;
|
||||||
marginBottom: 0,
|
const headlineSizePx = parseFloat(profile.headlineFontSize || "1.25rem") * (String(profile.headlineFontSize || "").includes("px") ? 1 : 16);
|
||||||
position: "relative",
|
const dateOffset = !isHorizontal ? undefined
|
||||||
top: profile.dateVerticalAlign === "top" ? "-0.35em" : profile.dateVerticalAlign === "bottom" ? "0.1em" : "-0.1em",
|
: profile.dateVerticalAlign === "top" ? `${-headlineSizePx * 0.55}px`
|
||||||
}}>
|
: profile.dateVerticalAlign === "bottom" ? "0px"
|
||||||
{formatDateHeader(date, language)}
|
: `${-headlineSizePx * 0.25}px`; // center
|
||||||
</span>
|
const dateStyle = isHorizontal ? {
|
||||||
)}
|
flexShrink: 0 as const, marginBottom: 0,
|
||||||
<h3
|
position: "relative" as const, top: dateOffset,
|
||||||
className={`weekly-day-name ${isSameDay(date, new Date()) ? "is-today" : ""}`}
|
} : { flexShrink: 0 as const };
|
||||||
style={{ marginBottom: 0, flexShrink: 0 }}
|
return (
|
||||||
>
|
<>
|
||||||
{getDayName(date, language, weekdayFormat, customWeekdayNames, weekStartDay, weekdayCase)}
|
{activeDateLayout === "left" && (
|
||||||
</h3>
|
<span className="weekly-day-date" style={dateStyle}>
|
||||||
{(activeDateLayout === "right" ||
|
{formatDateHeader(date, language)}
|
||||||
activeDateLayout === "above" ||
|
</span>
|
||||||
activeDateLayout === "below" ||
|
)}
|
||||||
activeDateLayout === undefined) && (
|
<h3
|
||||||
<span className="weekly-day-date" style={{
|
className={`weekly-day-name ${isSameDay(date, new Date()) ? "is-today" : ""}`}
|
||||||
flexShrink: 0,
|
style={{ marginBottom: 0, flexShrink: 0 }}
|
||||||
marginBottom: (activeDateLayout === "above" || activeDateLayout === "below") ? undefined : 0,
|
>
|
||||||
...(activeDateLayout !== "above" && activeDateLayout !== "below" ? {
|
{getDayName(date, language, weekdayFormat, customWeekdayNames, weekStartDay, weekdayCase)}
|
||||||
position: "relative" as const,
|
</h3>
|
||||||
top: profile.dateVerticalAlign === "top" ? "-0.35em" : profile.dateVerticalAlign === "bottom" ? "0.1em" : "-0.1em",
|
{(activeDateLayout === "right" ||
|
||||||
} : {}),
|
activeDateLayout === "above" ||
|
||||||
}}>
|
activeDateLayout === "below" ||
|
||||||
{formatDateHeader(date, language)}
|
activeDateLayout === undefined) && (
|
||||||
</span>
|
<span className="weekly-day-date" style={dateStyle}>
|
||||||
)}
|
{formatDateHeader(date, language)}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user