Skip to content

Commit 41ddc71

Browse files
authored
feat(webui): Apply fixed, uniform label widths for SQL inputs in guided Presto UI. (#1639)
1 parent 679ea9e commit 41ddc71

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

components/webui/client/src/components/InputLabel/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ const {Text} = Typography;
1313
*
1414
* @param props
1515
* @param props.children The label text to display.
16+
* @param props.width Optional width for the label.
1617
* @return
1718
*/
18-
const InputLabel = ({children}: {children: React.ReactNode}) => {
19+
const InputLabel = ({children, width}: {children: React.ReactNode; width?: string | number}) => {
1920
const {token} = theme.useToken();
2021

2122
return (
@@ -26,6 +27,7 @@ const InputLabel = ({children}: {children: React.ReactNode}) => {
2627
borderBottomLeftRadius: `${token.borderRadius}px`,
2728
borderTopLeftRadius: `${token.borderRadius}px`,
2829
fontSize: token.fontSize,
30+
minWidth: width,
2931
}}
3032
>
3133
{children}

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/From.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import InputLabel from "../../../../../components/InputLabel";
22
import DatasetSelect from "../../Dataset/DatasetSelect";
33
import guidedGrid from "./index.module.css";
4+
import {LABEL_WIDTH} from "./typings";
45

56

67
/**
@@ -11,7 +12,7 @@ import guidedGrid from "./index.module.css";
1112
const From = () => {
1213
return (
1314
<div className={guidedGrid["gridItem"]}>
14-
<InputLabel>FROM</InputLabel>
15+
<InputLabel width={LABEL_WIDTH}>FROM</InputLabel>
1516
<DatasetSelect
1617
className={
1718
`${guidedGrid["noLeftBorderRadiusSelect"]} ${

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/OrderBy.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import useSearchStore from "../../../SearchState/index";
55
import usePrestoSearchState from "../../../SearchState/Presto";
66
import {SEARCH_UI_STATE} from "../../../SearchState/typings";
77
import guidedGrid from "./index.module.css";
8+
import {LABEL_WIDTH} from "./typings";
89

910

1011
/**
@@ -21,7 +22,7 @@ const OrderBy = () => {
2122

2223
return (
2324
<div className={guidedGrid["gridItem"]}>
24-
<InputLabel>ORDER BY</InputLabel>
25+
<InputLabel width={LABEL_WIDTH}>ORDER BY</InputLabel>
2526
<SqlInput
2627
className={guidedGrid["noLeftBorderRadius"] || ""}
2728
disabled={disabled}

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Select.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import useSearchStore from "../../../SearchState/index";
55
import usePrestoSearchState from "../../../SearchState/Presto";
66
import {SEARCH_UI_STATE} from "../../../SearchState/typings";
77
import guidedGrid from "./index.module.css";
8+
import {LABEL_WIDTH} from "./typings";
89

910

1011
/**
@@ -21,7 +22,7 @@ const Select = () => {
2122

2223
return (
2324
<div className={guidedGrid["gridItem"]}>
24-
<InputLabel>SELECT</InputLabel>
25+
<InputLabel width={LABEL_WIDTH}>SELECT</InputLabel>
2526
<SqlInput
2627
className={guidedGrid["noLeftBorderRadius"] || ""}
2728
disabled={disabled}

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Where.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import useSearchStore from "../../../SearchState/index";
55
import usePrestoSearchState from "../../../SearchState/Presto";
66
import {SEARCH_UI_STATE} from "../../../SearchState/typings";
77
import guidedGrid from "./index.module.css";
8+
import {LABEL_WIDTH} from "./typings";
89

910

1011
/**
@@ -21,7 +22,7 @@ const Where = () => {
2122

2223
return (
2324
<div className={guidedGrid["gridItem"]}>
24-
<InputLabel>WHERE</InputLabel>
25+
<InputLabel width={LABEL_WIDTH}>WHERE</InputLabel>
2526
<SqlInput
2627
className={guidedGrid["noLeftBorderRadius"] || ""}
2728
disabled={disabled}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* The fixed width for SQL clause labels.
3+
*/
4+
const LABEL_WIDTH = "85px";
5+
6+
export {LABEL_WIDTH};

0 commit comments

Comments
 (0)