-
Notifications
You must be signed in to change notification settings - Fork 20
/
styles.ts
123 lines (120 loc) · 4.06 KB
/
styles.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import { StyleSheet } from "react-native";
import type { TextStyle, ViewStyle } from "react-native";
export interface CustomTimerPickerStyles {
backgroundColor?: string;
disabledPickerContainer?: ViewStyle;
disabledPickerItem?: TextStyle;
pickerAmPmContainer?: ViewStyle;
pickerAmPmLabel?: TextStyle;
pickerContainer?: ViewStyle & { backgroundColor?: string };
pickerGradientOverlay?: ViewStyle;
pickerItem?: TextStyle;
pickerItemContainer?: ViewStyle & { height?: number };
pickerLabel?: TextStyle;
pickerLabelContainer?: ViewStyle;
text?: TextStyle;
theme?: "light" | "dark";
}
const DARK_MODE_BACKGROUND_COLOR = "#232323";
const DARK_MODE_TEXT_COLOR = "#E9E9E9";
const LIGHT_MODE_BACKGROUND_COLOR = "#F1F1F1";
const LIGHT_MODE_TEXT_COLOR = "#1B1B1B";
export const generateStyles = (
customStyles: CustomTimerPickerStyles | undefined,
options: { padWithNItems: number }
) =>
StyleSheet.create({
pickerContainer: {
flexDirection: "row",
marginRight: "8%",
backgroundColor:
customStyles?.backgroundColor ??
(customStyles?.theme === "dark"
? DARK_MODE_BACKGROUND_COLOR
: LIGHT_MODE_BACKGROUND_COLOR),
...customStyles?.pickerContainer,
},
pickerLabelContainer: {
position: "absolute",
right: 4,
top: 0,
bottom: 0,
justifyContent: "center",
minWidth:
(customStyles?.pickerLabel?.fontSize ??
customStyles?.text?.fontSize ??
25) * 0.65,
...customStyles?.pickerLabelContainer,
},
pickerLabel: {
fontSize: 18,
fontWeight: "bold",
marginTop:
(customStyles?.pickerItem?.fontSize ??
customStyles?.text?.fontSize ??
25) / 6,
color:
customStyles?.theme === "dark"
? DARK_MODE_TEXT_COLOR
: LIGHT_MODE_TEXT_COLOR,
...customStyles?.text,
...customStyles?.pickerLabel,
},
pickerItemContainer: {
flexDirection: "row",
height: 50,
justifyContent: "center",
alignItems: "center",
width: (customStyles?.pickerItem?.fontSize ?? 25) * 3.6,
...customStyles?.pickerItemContainer,
},
pickerItem: {
textAlignVertical: "center",
fontSize: 25,
color:
customStyles?.theme === "dark"
? DARK_MODE_TEXT_COLOR
: LIGHT_MODE_TEXT_COLOR,
...customStyles?.text,
...customStyles?.pickerItem,
},
pickerAmPmContainer: {
position: "absolute",
right: 0,
top: 0,
bottom: 0,
justifyContent: "center",
...customStyles?.pickerLabelContainer,
...customStyles?.pickerAmPmContainer,
},
pickerAmPmLabel: {
fontSize: 18,
fontWeight: "bold",
marginTop: (customStyles?.pickerItem?.fontSize ?? 25) / 6,
color:
customStyles?.theme === "dark"
? DARK_MODE_TEXT_COLOR
: LIGHT_MODE_TEXT_COLOR,
...customStyles?.text,
...customStyles?.pickerLabel,
...customStyles?.pickerAmPmLabel,
},
disabledPickerContainer: {
opacity: 0.4,
...customStyles?.disabledPickerContainer,
},
disabledPickerItem: {
opacity: 0.2,
...customStyles?.disabledPickerItem,
},
pickerGradientOverlay: {
position: "absolute",
left: 0,
right: 0,
height:
options.padWithNItems === 0
? "30%"
: (customStyles?.pickerItemContainer?.height ?? 50) * 0.8,
...customStyles?.pickerGradientOverlay,
},
});