PromucFlow_constructor/app/client/src/components/editorComponents/InputComponent.tsx
Valera Melnikov 9eac55a380
chore: add consistent-type-definitions rule (#27907)
## Description
Add consistent-type-definitions rule
2023-10-11 10:35:24 +03:00

40 lines
1.0 KiB
TypeScript

import React from "react";
import styled from "styled-components";
import type { Intent as BlueprintIntent } from "@blueprintjs/core";
import { InputGroup } from "@blueprintjs/core";
import type { Intent } from "constants/DefaultTheme";
import { BlueprintInputTransform } from "constants/DefaultTheme";
import type { WrappedFieldInputProps } from "redux-form";
const StyledInputGroup = styled(InputGroup)`
&&& {
${BlueprintInputTransform};
}
`;
export type InputType = "text" | "password" | "number" | "email" | "tel";
interface InputComponentProps {
placeholder: string;
input: Partial<WrappedFieldInputProps>;
type?: InputType;
intent?: Intent;
disabled?: boolean;
autoFocus?: boolean;
}
function InputComponent(props: InputComponentProps) {
return (
<StyledInputGroup
{...props.input}
autoFocus={props.autoFocus}
disabled={props.disabled}
intent={props.intent as BlueprintIntent}
placeholder={props.placeholder}
type={props.type}
/>
);
}
export default InputComponent;