feat: Unify scaling and apply to clock widget
This commit is contained in:
7 files changed
+53
-6
No files matched your search
@@ -22,19 +22,19 @@ export default function ClockWidget({ options }: WidgetComponentProps<"clock">)
|
||||
const timezone = options.useCustomTimezone ? options.timezone : Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
const time = useCurrentTime(options);
|
||||
return (
|
||||
<Stack className="clock-text-stack" h="100%" align="center" justify="center" gap="10cqmin">
|
||||
<Stack className="clock-text-stack" h="100%" align="center" justify="center" gap="lg">
|
||||
{options.customTitleToggle && (
|
||||
<Text className="clock-customTitle-text" size="12.5cqmin" ta="center">
|
||||
<Text className="clock-customTitle-text" ta="center">
|
||||
{options.customTitle}
|
||||
</Text>
|
||||
)}
|
||||
<Text className="clock-time-text" fw={700} size="22.5cqmin" lh="1">
|
||||
<Text className="clock-time-text" fw="bold" size="lg" lh={1}>
|
||||
{options.customTimeFormat
|
||||
? dayjs(time).tz(timezone).format(customTimeFormat)
|
||||
: dayjs(time).tz(timezone).format(timeFormat)}
|
||||
</Text>
|
||||
{options.showDate && (
|
||||
<Text className="clock-date-text" size="12.5cqmin" p="1cqmin" lineClamp={1}>
|
||||
<Text className="clock-date-text" lineClamp={1}>
|
||||
{options.customDateFormat
|
||||
? dayjs(time).tz(timezone).format(customDateFormat)
|
||||
: dayjs(time).tz(timezone).format(dateFormat)}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
import { Button, Group, NumberInput, Stack } from "@mantine/core";
|
||||
|
||||
import { useForm } from "@homarr/form";
|
||||
import { createModal } from "@homarr/modals";
|
||||
@@ -30,6 +30,23 @@ export const WidgetAdvancedOptionsModal = createModal<InnerProps>(({ actions, in
|
||||
label={t("item.edit.field.customCssClasses.label")}
|
||||
{...form.getInputProps("customCssClasses")}
|
||||
/>
|
||||
<NumberInput
|
||||
label={t("item.edit.field.customTextSize.label")}
|
||||
min={0}
|
||||
max={10}
|
||||
step={0.1}
|
||||
defaultValue={1}
|
||||
{...form.getInputProps("customTextSize")}
|
||||
/>
|
||||
<NumberInput
|
||||
label={t("item.edit.field.customSpacing.label")}
|
||||
description={t("item.edit.field.customSpacing.description")}
|
||||
min={0}
|
||||
max={10}
|
||||
step={0.1}
|
||||
defaultValue={1}
|
||||
{...form.getInputProps("customSpacing")}
|
||||
/>
|
||||
<Group justify="end">
|
||||
<Button onClick={actions.closeModal} variant="subtle" color="gray">
|
||||
{t("common.action.cancel")}
|
||||
|
||||
@@ -60,6 +60,8 @@ export const WidgetEditModal = createModal<ModalProps<WidgetKind>>(({ actions, i
|
||||
integrationIds: z.array(z.string()),
|
||||
advancedOptions: z.object({
|
||||
customCssClasses: z.array(z.string()),
|
||||
customTextSize: z.number().min(0).max(10),
|
||||
customSpacing: z.number().min(0).max(10),
|
||||
}),
|
||||
}),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user