Skip to content

Build your personal knowledge base with Trilium Notes

style(calendar): give the repeats row the width the switch does not need

Elian Dorane812ea6a13d3
diff --git a/apps/client/src/widgets/collections/calendar/EventDatesEditor.tsx b/apps/client/src/widgets/collections/calendar/EventDatesEditor.tsx
index abb48c0a82..a5d4ba157d 100644
--- a/apps/client/src/widgets/collections/calendar/EventDatesEditor.tsx
+++ b/apps/client/src/widgets/collections/calendar/EventDatesEditor.tsx
@@ -62,7 +62,7 @@ export default function EventDatesEditor({ note, repeats }: {
nameless because the field's name speaks for it — a switch rather than a checkbox,
as it reads as the mode flip it is. */}
<EventFieldRow>
- <EventField name={t("calendar.dates.all_day")} htmlFor={allDayId}>
+ <EventField name={t("calendar.dates.all_day")} htmlFor={allDayId} compact>
<div className="calendar-all-day-switch">
<FormToggle
id={allDayId}
diff --git a/apps/client/src/widgets/collections/calendar/EventField.css b/apps/client/src/widgets/collections/calendar/EventField.css
index f1cb8f1ed9..92b86bc364 100644
--- a/apps/client/src/widgets/collections/calendar/EventField.css
+++ b/apps/client/src/widgets/collections/calendar/EventField.css
@@ -9,15 +9,22 @@
gap: 4px;
}
- /* Fields sharing one line, splitting it evenly whatever each holds. */
+ /* Fields sharing one line, splitting what is left of it evenly. Parted by more than the
+ controls within a field are, so the line reads as two fields rather than as one field's
+ worth of controls. */
.calendar-event-field-row {
display: flex;
- gap: 10px;
+ gap: 16px;
> * {
flex: 1 1 0;
min-width: 0;
}
+
+ /* Except those that asked for no more room than they need (see EventField's `compact`). */
+ > .calendar-event-field-compact {
+ flex: 0 0 auto;
+ }
}
/* Faded as the promoted grid fades its labels (see theme-next/shell.css), so the event's own
diff --git a/apps/client/src/widgets/collections/calendar/EventField.tsx b/apps/client/src/widgets/collections/calendar/EventField.tsx
index d6e7a1f86c..f6dd4eec47 100644
--- a/apps/client/src/widgets/collections/calendar/EventField.tsx
+++ b/apps/client/src/widgets/collections/calendar/EventField.tsx
@@ -18,14 +18,17 @@ export function EventFieldList({ children }: { children: ComponentChildren }) {
* one input to speak for ({@link htmlFor}), and reads as a heading where the field is a group —
* a row of weekday toggles has no single input to point at.
*/
-export function EventField({ name, htmlFor, children }: {
+export function EventField({ name, htmlFor, compact, children }: {
name: string;
/** The id of the field's input, for a field that has exactly one. */
htmlFor?: string;
+ /** Take no more of a shared line than the field's own name and control need, leaving the rest
+ * to whatever stands beside it (see {@link EventFieldRow}). */
+ compact?: boolean;
children: ComponentChildren;
}) {
return (
- <div className="calendar-event-field">
+ <div className={clsx("calendar-event-field", compact && "calendar-event-field-compact")}>
<label className="calendar-event-field-name" for={htmlFor}>{name}</label>
{children}
</div>