-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathquery.tsx
153 lines (136 loc) · 3.05 KB
/
query.tsx
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import styled, { css } from "styled-components";
import { default as Alert } from "antd/es/alert";
import { ReactNode } from "react";
import { AlertProps } from "antd/es/alert";
import { ToolTipLabel } from "./toolTip";
import { DocLink } from "components/ExternalLink";
export const QueryPropertyViewWrapper = styled.div`
display: flex;
padding-bottom: 72px;
gap: 20px;
flex-wrap: wrap;
`;
const QueryAlertWrapper = styled.div`
height: 32px;
width: 100%;
position: absolute;
bottom: 0;
.ant-alert-error {
border: none;
background: #fff3f1;
}
.ant-alert-icon {
margin-right: 8px;
margin-left: 16px;
}
.ant-alert {
padding: 0;
}
.ant-alert-message {
font-size: 13px;
color: #333333;
line-height: 32px;
}
`;
export const QueryAlert = (props: AlertProps) => (
<QueryAlertWrapper>
<Alert type={"error"} showIcon={true} {...props} />
</QueryAlertWrapper>
);
export const QuerySectionWrapper = styled.div`
display: flex;
flex-wrap: nowrap;
flex-direction: column;
width: 100%;
gap: 8px;
flex-grow: 1;
`;
export const QueryConfigWrapper = styled.div<{ $width?: string }>`
display: flex;
width: ${(props) => props.$width ?? "100%"};
align-items: flex-start;
flex-wrap: nowrap;
`;
const QueryConfigLabelWrapper = styled.div`
width: 112px;
flex-shrink: 0;
`;
interface QueryConfigLabelProps {
children?: ReactNode;
tooltip?: ReactNode;
labelHeight?: number | string;
}
export const QueryConfigLabel = (props: QueryConfigLabelProps) => (
<QueryConfigLabelWrapper>
<ToolTipLabel
title={props.tooltip}
label={props.children}
labelStyle={
props.labelHeight
? { height: props.labelHeight }
: {
height: 32,
lineHeight: "32px",
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
maxWidth: "100%",
}
}
/>
</QueryConfigLabelWrapper>
);
export const QueryConfigItemWrapper = styled.div<{ direction?: "row" | "column" }>`
min-width: 0;
flex-grow: 1;
${(props) => {
if (props.direction === "row") {
return css`
min-width: 0;
display: flex;
align-items: center;
`;
}
}}
`;
type TutorialStyle = "dropdownRight" | "begin";
const TutorialButtonWrapper = styled.div<{ $styleName: TutorialStyle }>`
height: 100%;
display: flex;
align-items: center;
${(props) => {
if (props.$styleName === "dropdownRight") {
return css`
padding-left: 8px;
width: 264px;
flex-grow: 1;
`;
}
}}
`;
export const QueryTutorialButton = ({
label,
url,
styleName,
}: {
label: string;
url?: string;
styleName: "dropdownRight" | "begin";
}) =>
url ? (
<TutorialButtonWrapper $styleName={styleName}>
<DocLink href={url}>{label}</DocLink>
</TutorialButtonWrapper>
) : (
<></>
);
export const TriggerTypeStyled = styled.div`
> div > div:nth-of-type(2) {
> div {
width: 100%;
}
::after {
display: none;
}
}
`;