Files
Homarr/packages/widgets/src/_inputs/widget-multiselect-input.tsx
Meier Lukas d57b771a17 feat: add pi hole summary integration (#521)
* feat: add pi hole summary integration

* feat: add pi hole summary widget

* fix: type issues with integrations and integrationIds

* feat: add middleware for integrations and improve cache redis channel

* feat: add error boundary for widgets

* fix: broken lock file

* fix: format format issues

* fix: typecheck issue

* fix: deepsource issues

* fix: widget sandbox without error boundary

* chore: address pull request feedback

* chore: remove todo comment and created issue

* fix: format issues

* fix: deepsource issue
2024-05-26 17:13:34 +02:00

32 lines
941 B
TypeScript

"use client";
import { MultiSelect } from "@mantine/core";
import { translateIfNecessary } from "@homarr/translation";
import type { CommonWidgetInputProps } from "./common";
import { useWidgetInputTranslation } from "./common";
import { useFormContext } from "./form";
export const WidgetMultiSelectInput = ({ property, kind, options }: CommonWidgetInputProps<"multiSelect">) => {
const t = useWidgetInputTranslation(kind, property);
const form = useFormContext();
return (
<MultiSelect
label={t("label")}
data={options.options.map((option) =>
typeof option === "string"
? option
: {
value: option.value,
label: translateIfNecessary(t, option.label)!,
},
)}
description={options.withDescription ? t("description") : undefined}
searchable={options.searchable}
{...form.getInputProps(`options.${property}`)}
/>
);
};