Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ProductInput 구현 #150

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/shared/ui/Input/product/ProductInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { AuthInputProps } from '@/shared/@common/types/input';
import HelperText from '../HelperText';
import { Input } from '../Input';

interface ProductInputProps extends AuthInputProps {
productName?: string;
}

export const ProductInput = ({
register,
errors,
productName,
}: ProductInputProps) => {
return (
<>
<Input
inputSize="small"
type="text"
placeholder="상품명 (상품 등록 여부를 확인해 주세요)"
defaultValue={productName || ''}
{...register('productName', {
required: '상품명을 입력해주세요',
maxLength: {
value: 20,
message: '상품명은 20자 이하로 작성해주세요',
},
})}
isError={!!errors.productName}
/>
<HelperText type={errors.productName ? 'error' : 'basic'}>
{errors.productName ? errors.productName.message : '최대 20자 가능'}
</HelperText>
</>
);
};
1 change: 1 addition & 0 deletions src/shared/ui/Input/product/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ProductInput';