PromucFlow_constructor/app/client/src/components/editorComponents/InputComponent.tsx

38 lines
951 B
TypeScript
Raw Normal View History

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