Skip to content

Commit f0d339f

Browse files
committed
Extract defaultColors
1 parent 70b0d53 commit f0d339f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/SwitchSelector.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
OptionInput
88
} from "./SwitchSelector.styled";
99
import {StylingPropsTypes} from "./SwitchSelector.styled";
10+
import {defaultColors} from "./defaultColors";
1011

1112
export type OptionType = {
1213
label: string | number | React.ReactElement | HTMLElement;
@@ -44,13 +45,13 @@ const SwitchSelector: React.FC<Props> = (props) => {
4445

4546
const {
4647
border = 0,
47-
backgroundColor = "#ecf0f1",
48-
selectedBackgroundColor = "#2ecc71",
48+
backgroundColor = defaultColors.backgroundColor,
49+
selectedBackgroundColor = defaultColors.selectedBackgroundColor,
4950
wrapperBorderRadius = 20,
5051
optionBorderRadius = 18,
5152
fontSize = 14,
52-
fontColor = "#000",
53-
selectedFontColor = "#fff",
53+
fontColor = defaultColors.fontColor,
54+
selectedFontColor = defaultColors.selectedFontColor,
5455
selectionIndicatorMargin = 2,
5556
forcedSelectedIndex
5657
} = props;

src/defaultColors.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const defaultColors = {
2+
backgroundColor: "#ecf0f1",
3+
selectedBackgroundColor: "#2ecc71",
4+
fontColor: "#000",
5+
selectedFontColor: "#fff"
6+
};

0 commit comments

Comments
 (0)