-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathglobal.d.ts
More file actions
91 lines (80 loc) · 2.36 KB
/
global.d.ts
File metadata and controls
91 lines (80 loc) · 2.36 KB
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
import * as H from 'history';
import { match } from 'react-router';
import AppActions from './src/store/actions/app';
import ProfileActions from './src/store/actions/profile';
import { SimpleStyle } from 'jss/css';
declare global {
type Actions = typeof AppActions & typeof ProfileActions & {};
interface IReduxAction {
payload: any;
type: string;
}
// TODO: For now keeping theme type here, ideally in future it will come from kudoo shared components
type Theme = {
drawer: {
closedWidth: number;
openWidth: number;
};
palette: {
blueGrey: { '100': string; '50': string };
grey: {
'100': string;
'200': string;
'300': string;
'400': string;
'50': string;
'500': string;
'600': string;
'700': string;
};
primary: {
color1: string;
color2: string;
color3: string;
};
secondary: { color1: string; color2: string };
shadow: {
color1: string;
color2: string;
color3: string;
};
};
typography: { font: { family1: string; family2: string } };
breakpoints: {
keys: Array<string>;
values: { [k: string]: number };
up: Function;
down: Function;
between: Function;
only: Function;
width: Function;
};
};
interface IComponentProps<ClassKeys extends string = ''> {
theme?: Theme;
classes?: ClassesKeys<ClassKeys>;
}
interface IRouteProps<ClassKeys extends string = ''>
extends IComponentProps<ClassKeys> {
actions?: Actions;
history?: H.History;
location?: H.Location;
match?: match;
}
type ClassesKeys<T extends string> = { [K in T]?: string };
/**
* Types for style files
*/
// This type is usefule for keys which has dynamic style based on props
type StyleInnerFn<Props = {}> = (props: Props) => any;
// This extends css in js type
type StyleExtend<P = {}> = {
[k in keyof SimpleStyle]: SimpleStyle[k] | StyleInnerFn<P>;
};
// this is helpful for selector keys like, &.active, &.hover, &.closed, &:hover
type CSSSelectorAnyKey<Props> = { [key: string]: StyleExtend<Props> };
// This type will be used to specify return type of style function
type StyleFnReturnType<T extends string, Props extends Object = {}> = {
[K in T]?: StyleExtend<Props> | CSSSelectorAnyKey<Props>;
};
}