Skip to content

Commit b19e15b

Browse files
WesSouzaarturbien
authored andcommitted
docs(radio): categorize under Controls
1 parent bde588c commit b19e15b

File tree

3 files changed

+37
-66
lines changed

3 files changed

+37
-66
lines changed

src/Radio/Radio.mdx

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/Radio/Radio.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const Wrapper = styled.div`
2626
}
2727
`;
2828
export default {
29-
title: 'Radio',
29+
title: 'Controls/Radio',
3030
component: Radio,
3131
decorators: [story => <Wrapper>{story()}</Wrapper>]
3232
} as ComponentMeta<typeof Radio>;

src/Radio/Radio.tsx

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -136,38 +136,42 @@ const CheckboxComponents = {
136136
menu: StyledMenuCheckbox
137137
};
138138

139-
const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(
140-
{
141-
checked,
142-
className = '',
143-
disabled = false,
144-
label = '',
145-
onChange,
146-
style = {},
147-
variant = 'default',
148-
...otherProps
149-
},
150-
ref
151-
) {
152-
const CheckboxComponent = CheckboxComponents[variant];
139+
const Radio = forwardRef<HTMLInputElement, RadioProps>(
140+
(
141+
{
142+
checked,
143+
className = '',
144+
disabled = false,
145+
label = '',
146+
onChange,
147+
style = {},
148+
variant = 'default',
149+
...otherProps
150+
},
151+
ref
152+
) => {
153+
const CheckboxComponent = CheckboxComponents[variant];
153154

154-
return (
155-
<StyledLabel $disabled={disabled} className={className} style={style}>
156-
<CheckboxComponent $disabled={disabled} role='presentation'>
157-
{checked && <Icon $disabled={disabled} variant={variant} />}
158-
</CheckboxComponent>
159-
<StyledInput
160-
disabled={disabled}
161-
onChange={disabled ? undefined : onChange}
162-
readOnly={disabled}
163-
type='radio'
164-
checked={checked}
165-
ref={ref}
166-
{...otherProps}
167-
/>
168-
{label && <LabelText>{label}</LabelText>}
169-
</StyledLabel>
170-
);
171-
});
155+
return (
156+
<StyledLabel $disabled={disabled} className={className} style={style}>
157+
<CheckboxComponent $disabled={disabled} role='presentation'>
158+
{checked && <Icon $disabled={disabled} variant={variant} />}
159+
</CheckboxComponent>
160+
<StyledInput
161+
disabled={disabled}
162+
onChange={disabled ? undefined : onChange}
163+
readOnly={disabled}
164+
type='radio'
165+
checked={checked}
166+
ref={ref}
167+
{...otherProps}
168+
/>
169+
{label && <LabelText>{label}</LabelText>}
170+
</StyledLabel>
171+
);
172+
}
173+
);
174+
175+
Radio.displayName = 'Radio';
172176

173177
export { Radio, RadioProps };

0 commit comments

Comments
 (0)