@hoddy-ui/core 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +1 -1
- package/package.json +1 -1
- package/src/Components/Locator.tsx +4 -2
- package/src/config/index.ts +4 -21
- package/src/theme/colors.ts +9 -1
- package/src/types.ts +19 -0
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -16,7 +16,10 @@ import Typography from "./Typography";
|
|
|
16
16
|
const { GOOGLE_MAP_API_KEY } = getApiKey();
|
|
17
17
|
|
|
18
18
|
if (GOOGLE_MAP_API_KEY) Location.setGoogleApiKey(GOOGLE_MAP_API_KEY);
|
|
19
|
-
else
|
|
19
|
+
else
|
|
20
|
+
console.error(
|
|
21
|
+
"Google map api key needs to be set to use this component \nMake sure to run initialize() with a valid google map api key"
|
|
22
|
+
);
|
|
20
23
|
|
|
21
24
|
type predictionType = {
|
|
22
25
|
id: string;
|
|
@@ -224,4 +227,3 @@ export const Locator: React.FC<LocatorProps> = ({
|
|
|
224
227
|
</View>
|
|
225
228
|
);
|
|
226
229
|
};
|
|
227
|
-
|
package/src/config/index.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
// import * as fs from "fs";
|
|
2
|
+
import { setExtraColors } from "../theme/colors";
|
|
3
|
+
import { extraColorTypes } from "../types";
|
|
2
4
|
import { setApiKey } from "./KeyManager";
|
|
3
5
|
|
|
4
6
|
type configProps = {
|
|
5
7
|
googleMapApiKey?: string;
|
|
6
|
-
colors?:
|
|
7
|
-
primary?: {
|
|
8
|
-
mains: string;
|
|
9
|
-
light: string;
|
|
10
|
-
dark: string;
|
|
11
|
-
text: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
8
|
+
colors?: extraColorTypes;
|
|
14
9
|
};
|
|
15
10
|
|
|
16
11
|
export function initialize(config: configProps): void {
|
|
@@ -18,20 +13,8 @@ export function initialize(config: configProps): void {
|
|
|
18
13
|
setApiKey({
|
|
19
14
|
GOOGLE_MAP_API_KEY: config.googleMapApiKey,
|
|
20
15
|
});
|
|
16
|
+
if (config.colors) setExtraColors(config.colors);
|
|
21
17
|
} catch (error) {
|
|
22
18
|
console.error("Error reading the config file:", error);
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
|
-
// export function loadConfig(): void {
|
|
26
|
-
// try {
|
|
27
|
-
// const configData = fs.readFileSync("./hui-config.json", "utf-8");
|
|
28
|
-
// const config: configProps = JSON.parse(configData);
|
|
29
|
-
// setApiKey({
|
|
30
|
-
// GOOGLE_MAP_API_KEY: config.googleMapApiKey,
|
|
31
|
-
// });
|
|
32
|
-
|
|
33
|
-
// console.log("Got key from frontend", config.googleMapApiKey);
|
|
34
|
-
// } catch (error) {
|
|
35
|
-
// console.error("Error reading the config file:", error);
|
|
36
|
-
// }
|
|
37
|
-
// }
|
package/src/theme/colors.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ThemeTypes } from "../types";
|
|
1
|
+
import { ThemeTypes, extraColorTypes } from "../types";
|
|
2
2
|
|
|
3
3
|
const lightColors = {
|
|
4
4
|
white: {
|
|
@@ -65,6 +65,13 @@ const darkColors = {
|
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
+
let extraColors: extraColorTypes = {
|
|
69
|
+
dark: {},
|
|
70
|
+
light: {},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const setExtraColors = (c: extraColorTypes) => (extraColors = c);
|
|
74
|
+
|
|
68
75
|
export default function colors(theme: ThemeTypes) {
|
|
69
76
|
const dynamicColors = theme === "dark" ? darkColors : lightColors;
|
|
70
77
|
return {
|
|
@@ -150,5 +157,6 @@ export default function colors(theme: ThemeTypes) {
|
|
|
150
157
|
main: "#344054",
|
|
151
158
|
},
|
|
152
159
|
...dynamicColors,
|
|
160
|
+
...extraColors[theme],
|
|
153
161
|
};
|
|
154
162
|
}
|
package/src/types.ts
CHANGED
|
@@ -21,6 +21,25 @@ export type colorTypes =
|
|
|
21
21
|
| "blue"
|
|
22
22
|
| "textSecondary";
|
|
23
23
|
|
|
24
|
+
export type extraColorTypes = {
|
|
25
|
+
dark: {
|
|
26
|
+
[key: string]: {
|
|
27
|
+
main: string;
|
|
28
|
+
light: string;
|
|
29
|
+
dark: string;
|
|
30
|
+
text: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
light: {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
main: string;
|
|
36
|
+
light: string;
|
|
37
|
+
dark: string;
|
|
38
|
+
text: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
24
43
|
export interface ThemeActionTypes {
|
|
25
44
|
type: ThemeModes;
|
|
26
45
|
payload?: ThemeTypes;
|