feat: add widget preview pages (#9)
* 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
This commit is contained in:
25
packages/widgets/src/_inputs/widget-select-input.tsx
Normal file
25
packages/widgets/src/_inputs/widget-select-input.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
"use client";
|
||||
|
||||
import { Select } from "@homarr/ui";
|
||||
|
||||
import type { CommonWidgetInputProps } from "./common";
|
||||
import { useWidgetInputTranslation } from "./common";
|
||||
import { useFormContext } from "./form";
|
||||
|
||||
export const WidgetSelectInput = ({
|
||||
property,
|
||||
sort,
|
||||
options,
|
||||
}: CommonWidgetInputProps<"select">) => {
|
||||
const t = useWidgetInputTranslation(sort, property);
|
||||
const form = useFormContext();
|
||||
|
||||
return (
|
||||
<Select
|
||||
label={t("label")}
|
||||
data={options.options as unknown as string[]}
|
||||
description={options.withDescription ? t("description") : undefined}
|
||||
{...form.getInputProps(property)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user