Skip to content

Commit

Permalink
🎉 Input 컴포넌트 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
oaoong committed Oct 27, 2023
1 parent ecc6e2f commit 7d7ac58
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/components/ui/Input/Input.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Meta, StoryObj } from '@storybook/react'
import { Input } from './Input'

const meta = {
title: 'UI/Input',
component: Input,
tags: ['autodocs'],
argTypes: {},
} satisfies Meta<typeof Input>

export default meta
type Story = StoryObj<typeof meta>

export const Normal: Story = {
args: {},
}

export const Disabled: Story = {
args: {},
}
24 changes: 24 additions & 0 deletions src/components/ui/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from 'react'
import { cn } from '@/utils'

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}

const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => {
return (
<input
type={type}
className={cn(
'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-primary-color focus-visible:outline-1 focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
className,
)}
ref={ref}
{...props}
/>
)
},
)
Input.displayName = 'Input'

export { Input }
3 changes: 3 additions & 0 deletions src/components/ui/Input/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Input } from './Input'

export default Input

0 comments on commit 7d7ac58

Please sign in to comment.