/
theme.ts
79 lines (76 loc) · 1.62 KB
/
theme.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
import { Theme } from 'theme-ui'
export const modalTheme = {
modals: {
// Modal components
backdrop: {
zIndex: `backdrop`,
position: `fixed`,
top: 0,
left: 0,
right: 0,
bottom: 0,
background: `rgba(0,0,0,0.3)`,
},
content: {
px: '1rem',
flexGrow: 1,
overflowY: 'scroll',
},
footer: {
minHeight: 16,
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
px: '1rem',
},
title: {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
minHeight: 16,
px: '1rem',
},
// Modal variants
default: {
backgroundColor: 'background',
borderRadius: 'lg',
boxShadow: `md`,
display: `flex`,
flexDirection: `column`,
maxHeight: `80vh`,
minHeight: '16rem',
minWidth: '16rem',
maxWidth: 'min(90vw, 64rem)',
position: `absolute`,
top: [`25%`, `10%`, `10%`],
zIndex: `modal`,
},
defaultFullScreen: {
backgroundColor: 'background',
borderRadius: 0,
display: `flex`,
flexDirection: `column`,
minHeight: '100vh',
maxHeight: '100vh',
height: `fill-available`,
position: `absolute`,
top: 0,
width: `100vw`,
zIndex: `modal`,
},
},
zIndices: {
backdrop: 100,
modal: 110,
},
}
export function withModalTheme<T extends Theme>(theme: T) {
return {
...theme,
modals: { ...modalTheme.modals, ...((theme as any)?.modals ?? {}) },
zIndices: {
...modalTheme.zIndices,
...(theme?.zIndices ?? []),
},
}
}