Skip to content

Commit

Permalink
feat(input): add all types (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
jer3m01 authored Dec 18, 2023
1 parent 7c5993a commit e28f5ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/components/input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type InputProps = IntrinsicComponentProps<
value?: string;
defaultValue?: string;
onChange?: (value: string) => void;
type?: "text" | "textarea";
type?: HTMLInputElement["type"] | "textarea";
size?: "small" | "default" | "large";
label?: string;
danger?: boolean;
Expand Down Expand Up @@ -108,11 +108,9 @@ export function Input(props: InputProps) {
{/* @ts-ignore: TS Can't infer type */}
<Dynamic
component={
{
text: TextField.Input,
textarea: TextField.TextArea,
}[local.type!]
local.type === "textarea" ? TextField.TextArea : TextField.Input
}
type={local.type === "textarea" ? undefined : local.type}
{...combinedProps}
/>

Expand Down
2 changes: 1 addition & 1 deletion src/stories/Input.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
onChange: { action: "onChange" },
type: {
control: { type: "select" },
options: ["text", "textarea"],
options: ["text", "textarea", "email", "password"],
},
size: {
control: { type: "select" },
Expand Down

0 comments on commit e28f5ac

Please sign in to comment.