Skip to content

Commit

Permalink
fix: RadioButton 컴포넌트 수정
Browse files Browse the repository at this point in the history
-value와 label props 분리
  • Loading branch information
hanyugeon committed Apr 29, 2024
1 parent 9ea28d4 commit 1fbbf18
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/v1/base/RadioButton.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ComponentPropsWithoutRef, forwardRef, Ref } from 'react';

type RadioButtonProps = {
label?: string;
} & Omit<ComponentPropsWithoutRef<'input'>, 'id' | 'type' | 'className'>;

const BASE_RADIO_BUTTON_CLASSES =
'px-[1.2rem] py-[0.5rem] bg-main-600/[0.18] text-main-900 text-sm font-normal rounded-[2rem] cursor-pointer w-full h-full peer-checked:bg-main-900 peer-checked:text-white';

const RadioButton = (
{
name,
value,
...props
}: Omit<ComponentPropsWithoutRef<'input'>, 'id' | 'type' | 'className'>,
{ name, value, label, ...props }: RadioButtonProps,
ref: Ref<HTMLInputElement>
) => {
return (
Expand All @@ -22,7 +22,7 @@ const RadioButton = (
ref={ref}
{...props}
/>
<span className={BASE_RADIO_BUTTON_CLASSES}>{value}</span>
<span className={BASE_RADIO_BUTTON_CLASSES}>{label ?? value}</span>
</label>
);
};
Expand Down

0 comments on commit 1fbbf18

Please sign in to comment.