forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdashboardGrid.ts
80 lines (69 loc) · 2.73 KB
/
dashboardGrid.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
import { css } from '@emotion/react';
import { GrafanaTheme2 } from '@grafana/data';
export function getDashboardGridStyles(theme: GrafanaTheme2) {
return css({
'.react-resizable-handle': {
// this needs to use visibility and not display none in order not to cause resize flickering
visibility: 'hidden',
},
'.react-grid-item, #grafana-portal-container': {
touchAction: 'initial !important',
'&:hover': {
'.react-resizable-handle': {
visibility: 'visible',
},
},
},
[theme.breakpoints.down('md')]: {
'.react-grid-layout': {
height: 'unset !important',
},
'.react-grid-item': {
display: 'block !important',
transitionProperty: 'none !important',
// can't avoid type assertion here due to !important
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
position: 'unset !important' as 'unset',
transform: 'translate(0px, 0px) !important',
marginBottom: theme.spacing(2),
boxShadow: `0 8px 24px ${theme.colors.primary.border} !important`,
borderRadius: theme.shape.borderRadius(2),
},
'.panel-repeater-grid-item': {
height: 'auto !important',
boxShadow: `0 8px 24px ${theme.colors.primary.border} !important`,
borderRadius: theme.shape.borderRadius(2),
},
},
'.react-grid-item.react-grid-placeholder': {
boxShadow: `0 8px 24px ${theme.colors.primary.border} !important`,
background: `${theme.colors.primary.transparent} !important`,
zIndex: '-1 !important',
opacity: 'unset !important',
},
'.react-grid-item > .react-resizable-handle::after': {
borderRight: `2px solid ${theme.isDark ? theme.v1.palette.gray1 : theme.v1.palette.gray3} !important`,
borderBottom: `2px solid ${theme.isDark ? theme.v1.palette.gray1 : theme.v1.palette.gray3} !important`,
},
'.react-grid-item > div:first-of-type': {
boxShadow: `0 8px 24px ${theme.colors.primary.border} !important`,
borderRadius: theme.shape.borderRadius(2),
},
// Hack for preventing panel menu overlapping.
'.react-grid-item.resizing.panel, .react-grid-item.panel.dropdown-menu-open, .react-grid-item.react-draggable-dragging.panel':
{
zIndex: theme.zIndex.dropdown,
},
// Disable animation on initial rendering and enable it when component has been mounted.
'.react-grid-item.cssTransforms': {
transitionProperty: 'none !important',
},
[theme.transitions.handleMotion('no-preference')]: {
'.react-grid-layout--enable-move-animations': {
'.react-grid-item.cssTransforms': {
transitionProperty: 'transform !important',
},
},
},
});
}