-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8878dd0
commit 1a562f8
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { HTMLInputTypeAttribute, InputHTMLAttributes } from "react"; | ||
|
||
export interface InputProps { | ||
disabled?: boolean; | ||
type: HTMLInputTypeAttribute; | ||
name?: string; | ||
id?: string; | ||
className?: string; | ||
value?: InputHTMLAttributes<HTMLInputElement>["value"]; | ||
placeholder?: string; | ||
onChange?: InputHTMLAttributes<HTMLInputElement>["onChange"]; | ||
} | ||
|
||
const Input: React.FC<InputProps> = ({ | ||
disabled, | ||
type, | ||
name, | ||
id, | ||
className, | ||
value, | ||
placeholder, | ||
onChange, | ||
}) => { | ||
return ( | ||
<input | ||
disabled={disabled} | ||
type={type} | ||
name={name} | ||
id={id} | ||
className={className} | ||
value={value} | ||
placeholder={placeholder} | ||
onChange={onChange} | ||
/> | ||
); | ||
}; | ||
|
||
export default Input; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import React from "react"; | ||
|
||
import { Input } from "../index_with_tw_base"; | ||
|
||
const meta = { | ||
title: "Atoms/Input", | ||
component: Input, | ||
} satisfies Meta<typeof Input>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const InputExample = () => ( | ||
<div> | ||
<Input | ||
type="text" | ||
placeholder="Enter your name" | ||
className="border border-gray-300 rounded-md p-2" | ||
/> | ||
</div> | ||
); | ||
|
||
export const ItemDefault: Story = { | ||
args: { | ||
type: "text", | ||
placeholder: "Enter your name", | ||
}, | ||
}; |