Skip to content

Commit 011e17e

Browse files
authored
Merge pull request #1296 from inplayer-org/ch/add-classname-for-external-styles-in-switch-comp
Ch/add classname for external styles in switch component
2 parents f92d03a + 96a95f3 commit 011e17e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Change Log
22

33
All notable changes to this project will be documented in this file.
4+
# [2.5.3] - 23-02-2021
45

5-
# [2.5.3] - 25-02-2021
6+
### Change
67

8+
- Add missing className for Switch component in order to externaly style it with styled-components
9+
710
### Fixes
811

912
- Daypicker moment type error

src/components/Switch/Switch.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type SwitchProps = {
1010
id: string;
1111
label: string;
1212
onChange: (checked: boolean) => void;
13+
className?: string;
1314
};
1415

1516
const MarginLeftLabel = styled(Label)`
@@ -66,15 +67,15 @@ const Slider = styled.span`
6667
}
6768
`;
6869

69-
const Switch = ({ id, checked, label, disabled = false, onChange }: SwitchProps) => {
70+
const Switch = ({ id, checked, label, disabled = false, onChange, className }: SwitchProps) => {
7071
const onToggleChange = (e: ChangeEvent<HTMLInputElement>) => {
7172
if (e.target) {
7273
onChange(e.target.checked);
7374
}
7475
};
7576

7677
return (
77-
<SwitchWrapper>
78+
<SwitchWrapper className={className}>
7879
<MarginLeftLabel disabled={disabled} htmlFor={id}>
7980
<Span>{label}</Span>
8081
<Input

0 commit comments

Comments
 (0)