Skip to content

Commit

Permalink
fix(components): pass styles to Selector and RadioButton label (#652)
Browse files Browse the repository at this point in the history
The label element is the main visual component since there is no wrapper element, so any custom
styles should be passed to the label.
  • Loading branch information
connor-baer authored Jul 22, 2020
1 parent a83f6d3 commit a3f807e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/components/RadioButton/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ const RadioButtonComponent = (
invalid,
disabled,
tracking,
className,
...props
}: RadioButtonProps,
ref: RadioButtonProps['ref'],
Expand All @@ -201,7 +202,12 @@ const RadioButtonComponent = (
onClick={handleChange}
ref={ref}
/>
<RadioButtonLabel htmlFor={id} disabled={disabled} invalid={invalid}>
<RadioButtonLabel
htmlFor={id}
disabled={disabled}
invalid={invalid}
className={className}
>
{children || label}
</RadioButtonLabel>
</>
Expand Down
7 changes: 6 additions & 1 deletion src/components/Selector/Selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function SelectorComponent(
checked,
onChange,
tracking,
className,
...props
}: SelectorProps,
ref: SelectorProps['ref'],
Expand All @@ -166,7 +167,11 @@ function SelectorComponent(
ref={ref}
{...props}
/>
<SelectorLabel htmlFor={inputId} disabled={disabled}>
<SelectorLabel
htmlFor={inputId}
disabled={disabled}
className={className}
>
{children}
</SelectorLabel>
</>
Expand Down

0 comments on commit a3f807e

Please sign in to comment.