refactor inputs
This commit is contained in:
1 parent
2c5d64ab86
commit
549f52655b
45 files changed
+301
-256
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { FC } from "react";
|
||||
import { useHAServices } from 'haService';
|
||||
import { InputAutoComplete, InputAutoCompletePropsBase } from './InputAutoComplete';
|
||||
import { prettyName } from 'utils/formatting';
|
||||
|
||||
export type InputServiceProps = InputAutoCompletePropsBase & { multiple?: false };
|
||||
|
||||
export const InputService: FC<InputServiceProps> = props => {
|
||||
const services = useHAServices();
|
||||
return <InputAutoComplete
|
||||
{...props}
|
||||
label={props.label ?? "Service"}
|
||||
options={services.getOptions()}
|
||||
getID={services.getID}
|
||||
getLabel={services.getLabel}
|
||||
groupBy={opt => (typeof opt !== 'string') ? prettyName(opt.domain) : ''}
|
||||
/>
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user