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;
|
2020-10-07 07:07:16 +00:00
|
|
|
autoFocus?: boolean;
|
2020-02-25 11:33:07 +00:00
|
|
|
};
|
|
|
|
|
|
2021-04-28 10:28:39 +00:00
|
|
|
function InputComponent(props: InputComponentProps) {
|
2020-02-25 11:33:07 +00:00
|
|
|
return (
|
|
|
|
|
<StyledInputGroup
|
|
|
|
|
{...props.input}
|
2021-04-28 10:28:39 +00:00
|
|
|
autoFocus={props.autoFocus}
|
2020-02-25 11:33:07 +00:00
|
|
|
disabled={props.disabled}
|
2021-04-28 10:28:39 +00:00
|
|
|
intent={props.intent as BlueprintIntent}
|
2020-02-25 11:33:07 +00:00
|
|
|
placeholder={props.placeholder}
|
|
|
|
|
type={props.type}
|
|
|
|
|
/>
|
|
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
}
|
2020-02-25 11:33:07 +00:00
|
|
|
|
|
|
|
|
export default InputComponent;
|