* feat: add widget definition system * fix: wrong typecheck command in turbo generator * chore: fix formatting * feat: add widget preview page * chore: fix formatting and type errors * chore: fix from widget edit modal and remove some never casts * chore: address pull request feedback
25 lines
603 B
TypeScript
25 lines
603 B
TypeScript
"use client";
|
|
|
|
import { Switch } from "@homarr/ui";
|
|
|
|
import type { CommonWidgetInputProps } from "./common";
|
|
import { useWidgetInputTranslation } from "./common";
|
|
import { useFormContext } from "./form";
|
|
|
|
export const WidgetSwitchInput = ({
|
|
property,
|
|
sort,
|
|
options,
|
|
}: CommonWidgetInputProps<"switch">) => {
|
|
const t = useWidgetInputTranslation(sort, property);
|
|
const form = useFormContext();
|
|
|
|
return (
|
|
<Switch
|
|
label={t("label")}
|
|
description={options.withDescription ? t("description") : undefined}
|
|
{...form.getInputProps(property, { type: "checkbox" })}
|
|
/>
|
|
);
|
|
};
|