Files
Shortumation/webapp/src/components/Inputs/AutoComplete/InputDevice.tsx
T
2022-09-05 15:09:41 -04:00

25 lines
604 B
TypeScript

import { FC } from "react";
import { useHADeviceRegistry } from "services/ha";
import { useLang } from "services/lang";
import {
InputAutoComplete,
InputAutoCompletePropsBase,
} from "./InputAutoComplete";
export type InputDeviceProps = InputAutoCompletePropsBase;
export const InputDevice: FC<InputDeviceProps> = (props) => {
// state
const lang = useLang();
const dr = useHADeviceRegistry();
return (
<InputAutoComplete
{...props}
label={props.label ?? lang.get("DEVICE")}
getID={dr.getID}
getLabel={dr.getLabel}
options={dr.getOptions()}
/>
);
};