Skip to content

Commit

Permalink
feat(design-system): Input 컴포넌트 required 설정 시 시각적 표시 추가 (#237)
Browse files Browse the repository at this point in the history
* feat(design-system): change to make a separate display if the property of the `Input` is `required`

* style(design-system): change required `*` symbol left margin size `ml-1` -> `ml-0.5`
  • Loading branch information
SWARVY authored Sep 20, 2024
1 parent 54499dc commit 0f9cb16
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/design-system/src/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
labelClassName?: string;
inputClassName?: string;
messageClassName?: string;
required?: boolean;
}

const Input = forwardRef<HTMLInputElement, InputProps>(
Expand All @@ -20,6 +21,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
labelClassName,
inputClassName,
messageClassName,
required,
...rest
},
ref,
Expand All @@ -32,6 +34,9 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
className={cn('mb-1 ml-1 text-xs', labelClassName)}
>
{label}
{required && (
<span className="font-bol ml-0.5 text-red-400">*</span>
)}
</label>
)}
<input
Expand All @@ -41,6 +46,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
'outline-clab-primary rounded-lg border p-2',
inputClassName,
)}
required={required}
{...rest}
/>
{message && (
Expand Down

0 comments on commit 0f9cb16

Please sign in to comment.